Re: Macro for findrecord

S

Steve Schapel

Your syntax of =[txtLookupNum] is correct and should work ok.
However, you would need to use a GoToControl action before the
FindRecord action to set the focus to the control on the form which is
bound to the field whose value you are looking up.

- Steve Schapel, Microsoft Access MVP


Hi,

not 100% sure but .... try putting in the full forms
reference to the control that has the value....

=Forms![NameOfYourForm]![txtLookupNum]

hth

chas
-----Original Message-----
I am trying to use a macro to "findrecord"
i have a cmd button that calls the macro to find a record
in a table
if i put my string into the "Find What" part of the
macro, the focus goes to that matching record (which is
what i want to happen) however, i want the "Find What"
part to check a textbox and look for that string
(txtLookupNum).
if i put =[txtLookupNum] in the "Find What" part, it
doesn't work.
PLEASE HELP !
my deadline is approaching to quickly

i am linking to a oracle db table and the table imports
fine and all the records can be navigated through via the
control at the bottom of my form. however i need to be
able to search a reference field and display the matching
record. if there is a better way, please let me know
.
 
C

corillio

i found some code that works but now have new problem.
1st, here is the code that is working:

Private Sub cmdFind_Click()
Me.txtRefNum.SetFocus
DoCmd.FindRecord "*" & Me.txtLookupNum & "*"
Me.txtLookupNum.SetFocus
End Sub

when the user hits the cmdFind button it shows me the
record (yippee !) however, if there is more than one
record in the dataset that matches the criteria, how do i
continue to click the cmdFind and it go to Next ?

example: say i enter 123 and there are 3 records
containing that data, how do i have it show next each
time i hit the button until all records are done or new
string is typed into the lookup box ?
-----Original Message-----
Your syntax of =[txtLookupNum] is correct and should work ok.
However, you would need to use a GoToControl action before the
FindRecord action to set the focus to the control on the form which is
bound to the field whose value you are looking up.

- Steve Schapel, Microsoft Access MVP


Hi,

not 100% sure but .... try putting in the full forms
reference to the control that has the value....

=Forms![NameOfYourForm]![txtLookupNum]

hth

chas
-----Original Message-----
I am trying to use a macro to "findrecord"
i have a cmd button that calls the macro to find a record
in a table
if i put my string into the "Find What" part of the
macro, the focus goes to that matching record (which is
what i want to happen) however, i want the "Find What"
part to check a textbox and look for that string
(txtLookupNum).
if i put =[txtLookupNum] in the "Find What" part, it
doesn't work.
PLEASE HELP !
my deadline is approaching to quickly

i am linking to a oracle db table and the table imports
fine and all the records can be navigated through via the
control at the bottom of my form. however i need to be
able to search a reference field and display the matching
record. if there is a better way, please let me know
.

.
 
C

chas

Hi Steve,

thanks for the clarification.

chas
-----Original Message-----
Your syntax of =[txtLookupNum] is correct and should work ok.
However, you would need to use a GoToControl action before the
FindRecord action to set the focus to the control on the form which is
bound to the field whose value you are looking up.

- Steve Schapel, Microsoft Access MVP


Snipped
 

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