Snowflake68
Registered User.
- Local time
- Today, 11:09
- Joined
- May 28, 2014
- Messages
- 452
I have two combo boxes (both Text) which I need to use in order to lookup a numeric value in a table matrix.
cboBox and cboPallet are my two combos
I have the following code but I am getting an error "Invalid use of Null"
But I replace the strPallett with one of the actual field names then it works OK so I know the value exists and the "Invalid use of Null" error is a red herring. The strBox variable is working though, its just the strPallett variable that I cannot get the syntax correct.
This code works
Any ideas please, Im pulling my hair out on this one.
Thanks
cboBox and cboPallet are my two combos
I have the following code but I am getting an error "Invalid use of Null"
Code:
Dim strBox As String
Dim strPallet As String
Dim strBoxesPerPallet As Double
strBox = cboBox ' this is the rowsource in the table to lookup
strPallet = cboPallett ' this determines which field in the table to lookup
'This is the line which causes the error
strBoxesPerPallet = DLookup("'" & strPallett & "'", "tbl_Q97i_PalletMatrix", "StockCode = " & "'" & strBox & "'")
MsgBox strBoxesPerPallet
But I replace the strPallett with one of the actual field names then it works OK so I know the value exists and the "Invalid use of Null" error is a red herring. The strBox variable is working though, its just the strPallett variable that I cannot get the syntax correct.
This code works
Code:
strBoxesPerPallet = DLookup("[PALLET-UK]", "tbl_Q97i_PalletMatrix", "StockCode = " & "'" & strBox & "'")
Any ideas please, Im pulling my hair out on this one.
Thanks