Converting AutoNumber to text

G

Guest

My primary key in one of my tables is defined as an autonumber. However, in a
Findrecord I need this object text. What command should I use to convert
autonumber to text?
 
R

Rob Oldfield

CStr. But you shouldn't really need to do it. Any more detail on what's
going wrong?
 
G

Guest

Hi Rob:

I was modifing the below procedure to fit my requirements:-

Private Sub cboFindRecord_AfterUpdate( )
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[pkEmployerID] = '" & Me![cboFindRecord] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

However, in this example pkEmployerID is a text while my search key is an
autonumber. Any thoughts?

Ken
 
R

Rick Brandt

Ken said:
Hi Rob:

I was modifing the below procedure to fit my requirements:-

Private Sub cboFindRecord_AfterUpdate( )
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[pkEmployerID] = ' " & Me![cboFindRecord] & " ' "
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

However, in this example pkEmployerID is a text while my search key
is an autonumber. Any thoughts?

Get rid of the single quotes and you're set to go. I added spaces above to make
them easier to see.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top