Hello experts,
I have a combo box (cboFacilityType) on a form (underlying table and field: tblDraws_Details.FacilityType) and after I update cboFacilityType I need to update another field in the same record (tblDraws_Details.ID_facility) but I need to update to the same value where tblFacilityCommitments.FacilityType=tblDraws_Details.FacilityType)
I basically I need to update [tblDraws_Details.ID_facility] where [tblFacilityCommitments.FacilityType = tblDraws_Details.FacilityType
I think it would look something like this (but it it doesnt update to anything) :
FYI:
Private Sub cboFacilityType_AfterUpdate()
Me.ID_facility = DLookup("FacilityType", "tblFacility_Commitments", "FacilityType=" & [FacilityType].Value & "")
' ^^^possibly facilitytype.column(1)-didnt work tho
End Sub
Possibly InsertInto would be another way to do this instead of dlookup because I believe Dlookup slows the db.
thank you
your #1 worked:
Me.ID_facility = DLookup("ID_facility", "tblFacility_Commitments",
I also modified your suggestion from column(1) to column (0) as the ID on the cbo is in the first column. After I did this, it worked just as the above:
Me.ID_facility = DLookup("ID_facility", "tblFacility_Commitments",
thank you very much for your expert assistance.