Linking forms based on two criteria

dealwi8me

Registered User.
Local time
Today, 04:13
Joined
Jan 5, 2005
Messages
187
Hello,

I want to link two forms based on two parameters NameID and Year. I tried the following but i get the error message "Invalid use of null"

stLinkCriteria = "[NameID]=" & Me![Name] & Year(Me.ApplicationDate) = Me![Year]

Can someone help me with this code line?

Thank you in advance.
 
dealwi8me said:
Hello,

I want to link two forms based on two parameters NameID and Year. I tried the following but i get the error message "Invalid use of null"

stLinkCriteria = "[NameID]=" & Me![Name] & Year(Me.ApplicationDate) = Me![Year]

Can someone help me with this code line?

Thank you in advance.

Have you broken it up to see where the error is. One thing is that you have forgotten the AND inbetween the 2 criteria (& is not the same)

Try
stLinkCriteria = "[NameID]=" & Me![Name]
(PS: shouldn't have a field called name!)

then
stLinkCriteria = Year(Me.ApplicationDate) = Me![Year]

then
stLinkCriteria = "[NameID]=" & Me![Name] & " and " & Year(Me.ApplicationDate) = Me![Year]

Is the NameID the same as the Name field
maybe

stLinkCriteria = "[Name]=" & Me![Name] & " AND " & Year(Me.ApplicationDate) = Me![Year]

HTH
Dave
 
Last edited:
Don't forget the spaces around the AND
 
forgetting AND was the error!

Thank you both for your help. :)
 
Hi dealwi8me, did dis actually work coz hav been tryin 2 do d same thing but i keep gettin type mismatch (error) & it doesn't specify exaclty where's d error
Pls c ma code

stLinkCriteria = "Customercode = " & Me![CombCustCode] And "customername = " & Me![CombCustName]
 

Users who are viewing this thread

Back
Top Bottom