B basilyos Registered User. Local time Today, 00:18 Joined Jan 13, 2014 Messages 256 Jan 14, 2014 #1 i want to bring all the records that are not like [sometext] i wrote this code If p_foreign <> "" Then p_SQL_criteria = "[Nationality]" & " NOT LIKE '" & p_foreign & "'" End If but it's not working
i want to bring all the records that are not like [sometext] i wrote this code If p_foreign <> "" Then p_SQL_criteria = "[Nationality]" & " NOT LIKE '" & p_foreign & "'" End If but it's not working
C CJ_London Super Moderator Staff member Local time Today, 08:18 Joined Feb 19, 2013 Messages 17,405 Jan 14, 2014 #2 The string looks OK so what are you doing with p_SQL_criteria once you have calculated it? You need to apply it to a form filter or the where parameter of docmd.openquery/form/report
The string looks OK so what are you doing with p_SQL_criteria once you have calculated it? You need to apply it to a form filter or the where parameter of docmd.openquery/form/report
C CJ_London Super Moderator Staff member Local time Today, 08:18 Joined Feb 19, 2013 Messages 17,405 Jan 14, 2014 #3 the other possibility is you haven't assigned a value to p_foreign - suggest change to Code: If nz(p_foreign) <> "" Then ....
the other possibility is you haven't assigned a value to p_foreign - suggest change to Code: If nz(p_foreign) <> "" Then ....
N namliam The Mailman - AWF VIP Local time Today, 09:18 Joined Aug 11, 2003 Messages 11,695 Jan 14, 2014 #4 basilyos said: i want to bring all the records that are not like [sometext] i wrote this code If p_foreign <> "" Then p_SQL_criteria = "[Nationality]" & " NOT LIKE '*" & p_foreign & "*'" End If but it's not working Click to expand... You are missng the wildcards:banghead:
basilyos said: i want to bring all the records that are not like [sometext] i wrote this code If p_foreign <> "" Then p_SQL_criteria = "[Nationality]" & " NOT LIKE '*" & p_foreign & "*'" End If but it's not working Click to expand... You are missng the wildcards:banghead: