By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,392 Members | 1,556 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,392 IT Pros & Developers. It's quick & easy.

ADO recordfind help

P: n/a
Hi, I am trying to build a database to be used as a timeclock in our
facility. I have been testing code to respond to an employee's input of
their ID number. However, I was wanting to repsond to a valid input with
the Employees actual name. Basically I have an employee table with an EmpID
(primary key), EmpFirstname, and EmpLastname. With the code below I cannot
make reference to the first name after the record is found. Can someone
identify what I am doing wrong or give me information on a better method.
Thanks in advance. -Mark

Dim MyDB As DAO.Database
Dim rs As DAO.Recordset
Dim MyString
MyString = Me!Text12.Text 'text12 is an unbound textbox for ID input
Set MyDB = CurrentDb
Set rs = MyDB.OpenRecordset("Select EmpID, EmpFirstname from tblEmployees "
_
& "where EmpID = """ & MyString & """", dbOpenSnapshot)

If Not rs.EOF Then
Dim msgnow
msgnow = "employee " & [EmpFirstname] & " was found"
MsgBox msgnow


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
That would be "employee " & rs!EmpFirstname

or "employee " & rs("EmpFirstname")

or even "employee " & rs.Fields("EmpFirstname") if you want to be explicit.
(You don't have to specify 'Fields', because the Fields collection is the
default property of a recordset, but you can specify it, as above, if you
prefer).

BTW: Your subject says 'ADO', but your code is using DAO.

--
Brendan Reynolds
"Mark Valk" <mv***@valkindustries.com> wrote in message
news:40**********@corp.newsgroups.com...
Hi, I am trying to build a database to be used as a timeclock in our
facility. I have been testing code to respond to an employee's input of
their ID number. However, I was wanting to repsond to a valid input with
the Employees actual name. Basically I have an employee table with an EmpID (primary key), EmpFirstname, and EmpLastname. With the code below I cannot make reference to the first name after the record is found. Can someone
identify what I am doing wrong or give me information on a better method.
Thanks in advance. -Mark

Dim MyDB As DAO.Database
Dim rs As DAO.Recordset
Dim MyString
MyString = Me!Text12.Text 'text12 is an unbound textbox for ID input
Set MyDB = CurrentDb
Set rs = MyDB.OpenRecordset("Select EmpID, EmpFirstname from tblEmployees " _
& "where EmpID = """ & MyString & """", dbOpenSnapshot)

If Not rs.EOF Then
Dim msgnow
msgnow = "employee " & [EmpFirstname] & " was found"
MsgBox msgnow


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.