I use this same format elsewhere in other databases and it works.
START OF CODE
InvoiceAmount = DLookup("InvoiceAmount", "tblInvoices", "[Invoice] = '" & Me.Invoice & "'")
END OF CODE
Here, it doesn’t work. I have tried this with a query and a table as the RecordSource of the form. Here, I have a form with a dropdown box on it. The ControlSource of the dropdown box is OrgID. When clicked, the dropdown displays the seven fields listed via a query. OrgID is there but doesn’t display because the width is zero. It is the bound column. In the AfterUpdate property I have the following:
START OF CODE
ReleaseTo = DLookup("ReleaseTo", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
Address = DLookup("Address", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
City = DLookup("City", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
State = DLookup("State", "tblDropROI", "OrgI = '" & Me.OrgID & "'")
ZipCode = DLookup("ZipCode", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
Telephone = DLookup("Telephone", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
END OF CODE
The fields on the form match exactly the fields on table tblDropROI. When the selection is made, I get a runtime error 3464, “Data type mismatch in criteria expression.” I also tried it with brackets around OrgID like the code below and get the same results.
START OF CODE
ReleaseTo = DLookup("ReleaseTo", "tblDropROI", "[OrgID] = '" & Me.OrgID & "'")
END OF CODE
Any suggestions?
Thank you.
START OF CODE
InvoiceAmount = DLookup("InvoiceAmount", "tblInvoices", "[Invoice] = '" & Me.Invoice & "'")
END OF CODE
Here, it doesn’t work. I have tried this with a query and a table as the RecordSource of the form. Here, I have a form with a dropdown box on it. The ControlSource of the dropdown box is OrgID. When clicked, the dropdown displays the seven fields listed via a query. OrgID is there but doesn’t display because the width is zero. It is the bound column. In the AfterUpdate property I have the following:
START OF CODE
ReleaseTo = DLookup("ReleaseTo", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
Address = DLookup("Address", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
City = DLookup("City", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
State = DLookup("State", "tblDropROI", "OrgI = '" & Me.OrgID & "'")
ZipCode = DLookup("ZipCode", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
Telephone = DLookup("Telephone", "tblDropROI", "OrgID = '" & Me.OrgID & "'")
END OF CODE
The fields on the form match exactly the fields on table tblDropROI. When the selection is made, I get a runtime error 3464, “Data type mismatch in criteria expression.” I also tried it with brackets around OrgID like the code below and get the same results.
START OF CODE
ReleaseTo = DLookup("ReleaseTo", "tblDropROI", "[OrgID] = '" & Me.OrgID & "'")
END OF CODE
Any suggestions?
Thank you.