C
crtopher
I have been following Martin Greene's advice here:
http://www.fontstuff.com/access/acctut10.htm
regarding cascading lists.
I have two combo boxes on a form, cboCategory and cboMainItem. I want
cboMainItem to take it's rowsource from cboCategory, afterUpdate of the
former. I have followed Martin's advice to the letter, and can get the
DLookup working perfectly when the cboMainItem.Value is a text field. If i
make it lookup a number, as in MainID, which is also an autoNumber, the
DLookup doesn't work, ie, the cboCategory doesn't update with each new record
where the cboMainItem is different.
My current code is this:
Private Sub Form_Current()
On Error Resume Next
cboCategory = DLookup("[Category]", "lkupMainItem", "[MainID] ='" &
cboMainItem.Value & "'")
cboMainItem.RowSource = "SELECT lkupMainItem.MainID " & _
"FROM lkupMainItem " & _
"WHERE lkupMainItem.Category = '" & cboCategory.Value & "' " & _
"ORDER BY lkupMainItem.MainIN;"
End Sub
Is there a problem using numbers or Autonumbers wirh DLookup??
Much appreciated
Chris
http://www.fontstuff.com/access/acctut10.htm
regarding cascading lists.
I have two combo boxes on a form, cboCategory and cboMainItem. I want
cboMainItem to take it's rowsource from cboCategory, afterUpdate of the
former. I have followed Martin's advice to the letter, and can get the
DLookup working perfectly when the cboMainItem.Value is a text field. If i
make it lookup a number, as in MainID, which is also an autoNumber, the
DLookup doesn't work, ie, the cboCategory doesn't update with each new record
where the cboMainItem is different.
My current code is this:
Private Sub Form_Current()
On Error Resume Next
cboCategory = DLookup("[Category]", "lkupMainItem", "[MainID] ='" &
cboMainItem.Value & "'")
cboMainItem.RowSource = "SELECT lkupMainItem.MainID " & _
"FROM lkupMainItem " & _
"WHERE lkupMainItem.Category = '" & cboCategory.Value & "' " & _
"ORDER BY lkupMainItem.MainIN;"
End Sub
Is there a problem using numbers or Autonumbers wirh DLookup??
Much appreciated
Chris