I have the following in an AfterUpdate event of a combo box:
Shelf = DLookup("[Shelf_Life]", "Shelf_Life_Tbl", ("[Stock_Number] = " & Me![stock].Column(0) & " And [Company] = " & Me![Shelf_Company].Column(0)))
Basically I want to look up the shelf life in another table based on the values selected in 2 combo boxes. This code is triggered after [Shelf_Company] is updated AND [Stock_Number] is not null.
I seem to have worked out the syntax correctly (I think!) but every time I run this I am told that "You cancelled the previous operation." Access help indicates that this means I need to update the recordset.
So I added:
set db = CurrentDb
Set rs = db.OpenRecordset("coa_select")
With rs
.Update
End With
Now I am told that I can't update the table without an addNew or Edit. I am totally lost here. All I want is to select 2 values seperately in the combo boxes and then for a variable to retireve its value by looking up the first 2 in the table....
any help here???
Shelf = DLookup("[Shelf_Life]", "Shelf_Life_Tbl", ("[Stock_Number] = " & Me![stock].Column(0) & " And [Company] = " & Me![Shelf_Company].Column(0)))
Basically I want to look up the shelf life in another table based on the values selected in 2 combo boxes. This code is triggered after [Shelf_Company] is updated AND [Stock_Number] is not null.
I seem to have worked out the syntax correctly (I think!) but every time I run this I am told that "You cancelled the previous operation." Access help indicates that this means I need to update the recordset.
So I added:
set db = CurrentDb
Set rs = db.OpenRecordset("coa_select")
With rs
.Update
End With
Now I am told that I can't update the table without an addNew or Edit. I am totally lost here. All I want is to select 2 values seperately in the combo boxes and then for a variable to retireve its value by looking up the first 2 in the table....
any help here???