If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Help with dlookup please.
Can someone please help me determine what is wrong with the following code:
Me.txtPalletNo = DLookup("[PalletBarcode]", "[dbo_StockLog]", "[BoxBarcode]=" & [Forms]![frmTraceBox]!txtBoxCode) Where... PalletBarcode is the value I want to retrieve. dbo_StockLog is the table in the data is stored in. This table is a linked table from an SQL server. I can open, add/delete data to the table, use it in querries, etc. BoxBarcode that I need to match from my form (frmTraceBox) txtBoxCode is the control on my form that contains the value I am trying to match in the table. When I run my code I get the following error.... The expression you entered as a query parameter produced this error: The object dosen't contain the Automation object "B9HHE1137390518" I know the value B9HHE1137390518 is a valid BoxBarcode as I have copied and pasted (as well as typed it in) the value directly from the table to the form for testing my code. Can anyone please tell me what I am doing wrong? All help is greatly appreciated. Thanks, FatMan |
#2
|
|||
|
|||
Help with dlookup please.
Hi,
as the boxcode is a text it should be transmitted between parenthesis. To send a " char you have to double it in code, so try Me.txtPalletNo = DLookup("[PalletBarcode]", "[dbo_StockLog]", "[BoxBarcode]= """ & [Forms]![frmTraceBox]!txtBoxCode) & """" greetings NG "FatMan" wrote: Can someone please help me determine what is wrong with the following code: Me.txtPalletNo = DLookup("[PalletBarcode]", "[dbo_StockLog]", "[BoxBarcode]=" & [Forms]![frmTraceBox]!txtBoxCode) Where... PalletBarcode is the value I want to retrieve. dbo_StockLog is the table in the data is stored in. This table is a linked table from an SQL server. I can open, add/delete data to the table, use it in querries, etc. BoxBarcode that I need to match from my form (frmTraceBox) txtBoxCode is the control on my form that contains the value I am trying to match in the table. When I run my code I get the following error.... The expression you entered as a query parameter produced this error: The object dosen't contain the Automation object "B9HHE1137390518" I know the value B9HHE1137390518 is a valid BoxBarcode as I have copied and pasted (as well as typed it in) the value directly from the table to the form for testing my code. Can anyone please tell me what I am doing wrong? All help is greatly appreciated. Thanks, FatMan |
Thread Tools | |
Display Modes | |
|
|