Code for checking table fields

RYOUAPHI

Registered User.
Local time
Yesterday, 23:57
Joined
Jul 30, 2008
Messages
12
Been a while since I coded.

Can someone help me with:

I am coding a button to check a particular field on a table. I have my connection and recordset in place. sp is the variable for my recordset for my table. The field on the table is Sales Person. I am starting from the first recod. How do I write my if statement to check and see if this field on this record = Jon Smith?

Adam
 
Something like:

Code:
If MyRecordSet.[Sales Person] = "Jon Smith" then
 do some code
End if
???
 
error

Method or Data Member not found

I seem to remember something like.

if recordset.????.field="Jon Smith then

code

end if

does that make any sense?
 
just remembered

if recordset.fields.item ([Sales Person]) = "jon smith" then


sound about right?
 
Post the entire pc of code. I think the problem may be elsewhere - :)
 
Im Ok

I'm working OK now. I remembered how to do it.

if rs.fields.item("Sales Person")=rs2.fields.item("Sales Person") then

code here

else

code here

end if
 
Oh. I didn't know you were using 2 recordsets. Glad you have it working.
 
fyi - That's still the long way 'round - :)
 
Ken,

Thanks for all your help. I have one more thing I am attempting to do that eludes me.

I have my DB, tables and queries and forms, oh my!
I have a linked table to an excel spreadsheet. I change the information on the spreadsheet once a week. I am attempting to query the information from the linked table(which includes, excluding information based on criteria), and appending/updating a non linked table with the data from this query. I am having trouble because the criteria I query with, obviously doesn't jive with when appending the non linked table. More specifically speaking:

the linked table is Summit Scores
the nonlinked table is Summit Score Table

I query all info from Summit Scores using criteria on the first2 columns(<>"" and <>"Total")

Then I click append table and tell it which table to append, and save the query.
When I run it it won;'t populate the table b/c I have to take the criteria out which of course throws the entire thing off.

Any ideas
 

Users who are viewing this thread

Back
Top Bottom