Help with FindRecord

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello again and thanks in advance..

I've got an orders table with a primary key of OHID (autonum). Ideally the
user could type the order they want to pull up in ctlOHID and have that
record be called up.

Since I'm using an autonumber, I can't have the user enter a value directly
into that field, so I have another unbound text box set up called
ctlOHGoToRec. In the afterupdate section of this I am trying to put this
code:

Dim varOHNewRec as Long
varOHNewRec = Me.ctlOHGoToRec
DoCmd.FindRecord varOHNewRec, , , , , acAll

When this code runs I get the following error:

2162: A macro set to one of the current fields properties failed because of
an error in a FindRecord action argument.

I don't see what it is I'm doing wrong, I thought all of the args would
work, but I've try to lay this out a few different ways (FindRecord
ctlOHGoToRec) but it doesn't take for some reason. Anybody have any ideas?

Thanks,
Jack
 
Try the following in the After Update event of ctlOHGoToRec:

Me.ctlOHID = Me.ctlOHGoToRec

See if that works for you.
 
Back
Top