VBA lookup and concatenate data in table

ECEK

Registered User.
Local time
Today, 18:52
Joined
Dec 19, 2012
Messages
717
Having selected my client and populated their unique Identifier (IOID) I ask if they have a partner via a message box?

Preceeding code has established the partners unique ID (called IOIDJ)
I'm trying to populate an unbound field on the parent form with the full_name of the client's partner where the IOIDJ is equal.

I currently have a message box as follows:

Code:
Dim LResponse As Integer

LResponse = MsgBox("Is this a Joint Report?", vbYesNo, "Continue")

If LResponse = vbYes Then
Me.Parent.JointOrNot = "Joint Report"

Dim IOIDJLkp As Variant

'IOIDJLkp = DLookup("[full_name]", "[qryCCASearch] = Me.Parent.IOIDJ")
'Me.Parent.PartnName = IOIDJLkp

Exit Sub
Else
  Me.Parent.IOLINK = Null
  Me.Parent.SJ = Null
  Me.Parent.PartnName = Null
End If

Im struggling to look up and return the full_name from a query (qryCCASearch) where IOIDJLkp is equal

error 3078
says cannot find "[qryCCASearch] = Me.Parent.IOIDJ"

What I am trying to do is look up the name of a client from a query and then populate Me.Parent.PartnName with this look up.

I think I'm close !!!
As always thanks for your time and patience.
 
Dlookup generally requires 3 parameters

Field to return
Table or query to search
Data to compare to find the correct record

Code:
IOIDJLkp = DLookup("[full_name]","[qryCCASearch]", "YourField = " & Me.Parent.IOIDJ)

assuming OIDJ is numeric

Code:
IOIDJLkp = DLookup("[full_name]", "[qryCCASearch]", "YourField = '" & Me.Parent.IOIDJ & "'")

if text

HTH
 
Gasman I love you
I had realised that I had ommitted the criteria on which to cpnnect the two fields however I would have struggled with the syntax regardless.

I'm indebted to you.
 
There are plenty of functions where I have to check the syntax, if i do not use them often.

Google is your friend. :D
 

Users who are viewing this thread

Back
Top Bottom