VBA Type Mismatch for link criteria

jk12

Always getting problems.
Local time
Today, 19:08
Joined
Feb 16, 2006
Messages
91
Hi all

Sorry if this has been answered elsewhere but I can't find the answer anywhere.

I have the code below to open a pop-up form from within a form but whenever the code runs I get Run-time Error 13, Type Mismatch.

Both the EnquiryCatergory and TenderRef fields are text fields as are the Descritpion and Tender fields so why would I get a ype Mismatch. Also when I debug the error and hover over each element I get the correct info shown i.e. Me![Description] = "Paving" and Me![Tender] = "11N216".

Code running is:
stLinkCriteria = "[EnquiryCategory]=" & "'" & Me![Description] & "'" And "[TenderRef]=" & "'" & Me![Tender] & "'"

Any help is appriciated.
 
You've got a quotes problem. Try

stLinkCriteria = "[EnquiryCategory]=" & "'" & Me![Description] & "' And [TenderRef]=" & "'" & Me![Tender] & "'"

I personally would avoid the extra concatenation:

stLinkCriteria = "[EnquiryCategory]= '" & Me![Description] & "' And [TenderRef]= '" & Me![Tender] & "'"
 
Perfect. I suspected it was something simple but was more than my brain could handle, especially after trawling through the site and internet for the last hour :)
 

Users who are viewing this thread

Back
Top Bottom