Hello everyone I have been stuck on this problem for over 4 days now, I just cannot figure out how to write the code to do this. If you look at a table in access and you press the drop down menu for one of the fields such as "first name" there are options in number filters the specific one I am trying to recreate is the "does not equal" filter such as if you want to display anyone that does not have the first name "Jamie" as their first name you would use the "does not equal" filter. How would I go about doing this?
Note: I am accessing a table through SQL server using Access.
Here is an example table you can use for reference in this case I am trying to filter out anyone with the first name "Jamie" and anyone with the last name "Cartman"
Please look at the Logic that I have provided at the bottom of the table first and see if it is good to use (some of my syntax are incorrect)
First Nam Last Nam Jamie Lanestor Green Arrow Eric Cartman Homer Simpson Jamie
ruhl Pernelli
Cartman
Here is what I was thinking of doing but having trouble referencing the column without actually referencing the field name itself.
'Using a for loop to go through all the values within the column "First Nam" but Len takes the length of the text it self not the column so that is an issue
for i= 1 to Len("[First Nam]")
'If the current value in the field "First Nam" does not equal "Jamie" (The syntax is wrong I believe) then....
if ("[First Nam]"(i)<> "Jamie") Then
'I do not know how to filter the data here and append them at the same time I was thinking of something like this clearly the syntax is wrong
Me.Filter="[First Nam] = " & "First Nam"(i) & """"
end if
' Now doing the same thing for the second Column by having a nested for loop so that nothing is out of scope
for j=1 to Len("[Last Nam]")
if ("[Last Nam]"(j) <> "Cartman") Then
'Attempting to append the filtered values so that i can save my previous filtered data without trying to overwrite them.
Me.Filter= Me.Filter & " AND Last Nam = """ & "Last Nam"(i) & """"
end if
next
Me.FilterOn= True
next