Need help with DLookup Function

Divit11

Registered User.
Local time
Today, 11:27
Joined
Dec 16, 2004
Messages
35
Never Mind... Need help with DLookup Function

While everyone was taking a few well deserved days off, I kept googling and found the solution :

strMemberCode = DLookup("[tyMember]", "tblTypeCodes", "[tyTypeCodeID]=Forms!frmAddEditMemberListings![cboTypeCode]")
Divit11

:confused: I am having no luck getting this DLookup function to work in an on click event procedure for a form whose record source is tblMemberListings. There is a one to many relationship between [tblTypeCodes].[tyTypeCodeID] and [tblMemberListings].[mlTypeCode]

I want to take the value in the combo control box named cboTypeCode and get a value in the tyMember field of another table called tblTypeCodes with the tyTypeCodeID (record key) equal cboTypeCode.Value.

This vba solution returns strMemberCode="" when I check the values in debugger.

Dim strMemberCode As String
strMemberCode = DLookup("[tyMember]", "tblTypeCodes", "[tyTypeCodeID]=" & cboTypeCode.Value)

I have visited Microsoft Visual Basic Help to get this far and I'm still missing something.

I am working in Access 2000, if that makes any difference.

Any help would be appreciated.

Divit11
 
Last edited:

Users who are viewing this thread

Back
Top Bottom