Sub ReadItem_Click() Dim oEnv As clsD3Environment Dim oConn1 As clsD3Connection Dim oItem As New clsD3DynamicArray Dim oFile As clsD3File
Set oEnv = New clsD3Environment Set oConn1 = oEnv.brOpenConnection("ODBC", "production") Set oFile = oConn1.brOpenFile("products")
On Error GoTo D3ErrorHandler
' Item-id is read from a text box Set oItem = oFile.brRead(Text1.Text) oItem.brConvert D3AMChr, " " ' Display the item in a text box Text2.Text = oItem.brCString
oConn1.brCloseFile oFile oEnv.brCloseConnection oConn1 Set oItem = Nothing Set oEnv = Nothing Exit Sub
D3ErrorHandler: Select Case Err.Number Case d3SrvErr_Access oItem.brCString = "Item not found" Case Else oItem.brCString = "Unrecognizable error" End Select Resume Next End Sub |