Checking More then One field

abby_1309

Registered User.
Local time
Today, 12:07
Joined
Mar 11, 2009
Messages
15
Hi I have a Small Issue.i am taking SSN from a Form,Validating it with the Table and Opening a New Form if the SSN Match using the Code Given Below:
Private Sub Mutual_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Mutual"
stLinkCriteria = "[Social Security Number]=" & Me![Social Security Number]


DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit Sub

End Sub
Now i want to add another Field to Validate in the "Green" line..how i can do that..plz
 
basically change:

stLinkCriteria = "[Social Security Number]=" & Me![Social Security Number]

To

stLinkCriteria = "[Social Security Number]=" & Me![Social Security Number] & " AND [YourOtherFieldHere]= " & Me![YourOtherFieldOnForm]

If your other field is text then you need quotes:

stLinkCriteria = "[Social Security Number]=" & Me![Social Security Number] & " AND [YourOtherFieldHere]= " & Chr(34) & Me![YourOtherFieldOnForm] & Chr(34)
 
Ok one of them is "Date/Time" and Third is "Number" Type Data.But when i tried the "Number" Type Data Field..like this:
stLinkCriteria = "[Social Security Number]=" & Me![Social Security Number] And "[Case Type]=" & Me![Case Type]

it Give Run Time Error Type 13..Type Mismtach..
and when i click debug ittake me to the "Green" Line
 
The AND has to be WITHIN the quotes and a space before it so it doesn't create a run-on sentence:

stLinkCriteria = "[Social Security Number]=" & Me![Social Security Number] & " And [Case Type]=" & Me![Case Type]
 
Oh, and to add a date field:

stLinkCriteria = "[Social Security Number]=" & Me![Social Security Number] & " And [Case Type]=" & Me![Case Type] & " AND [DateFieldName]= #" & Me![DateFieldName] & "#"
 
Thanks a Lot....ok what i have to do add the third Field which is date/Time.Let say it [M11Q Date]:
plz write the strLinkCriteria like above
Thanks
 
Thanks ..u are great and really helpful

No problem - and I forgot to welcome you to the forum -



welcometoawf.png
 

Users who are viewing this thread

Back
Top Bottom