Hi all,
I have a table for my products (tbl_winestock). In here there is a field (Grade) that looks up values from tbl_grade.
tbl_winestock
ProdID (PK)
ProductName
Grade (FK)
tbl_grade
GradeID (PK)
Grade (A1, A, B, C etc)
In tbl_winestock it is possible to have 2 identical products but with different grades, for example:
Sparkling Wine A1
Sparkling Wine C
When recording the consumption or purchase of products I need to be able to differentiate between these products. At present they are just listed in one big combobox. Taking the example above I'd like 'Sparkling Wine' to be listed just once in the first combobox and then a second, related combobox to list A1 and C as the only options available. Stock adjustments are then recorded against this line.
I hope that makes sense. I have tried the following code on a test form
Unfortunately I get the following error: Syntax error (missing operator) in query expression 'ID = 1046ORDER by Grade'
Any help would be greatly appreciated here.
Thanks
David
I have a table for my products (tbl_winestock). In here there is a field (Grade) that looks up values from tbl_grade.
tbl_winestock
ProdID (PK)
ProductName
Grade (FK)
tbl_grade
GradeID (PK)
Grade (A1, A, B, C etc)
In tbl_winestock it is possible to have 2 identical products but with different grades, for example:
Sparkling Wine A1
Sparkling Wine C
When recording the consumption or purchase of products I need to be able to differentiate between these products. At present they are just listed in one big combobox. Taking the example above I'd like 'Sparkling Wine' to be listed just once in the first combobox and then a second, related combobox to list A1 and C as the only options available. Stock adjustments are then recorded against this line.
I hope that makes sense. I have tried the following code on a test form
Code:
Private Sub cboproduct_AfterUpdate()
' Set the grade combo box to be limited by the selected product
Me.cbograde.RowSource = "SELECT GradeID, Grade " & _
"FROM tbl_grade " & _
"WHERE ID = " & Nz(Me.cboproduct) & _
"ORDER By Grade"
End Sub
Unfortunately I get the following error: Syntax error (missing operator) in query expression 'ID = 1046ORDER by Grade'
Any help would be greatly appreciated here.
Thanks
David