Find Records

R

Rob

I have a form whose control source is a table. To pull up
a particular records on the table the criteria needs to
include three fields to uniquely identify the record. So
I want the user to select each field using combo boxes
then be able to click on a cmd button to find the
records. Here is my code that does not work:

DoCmd.FindRecord Me![cmbID] And Me![cmbTransmittal] And Me!
[Box], acAnywhere, 0, _
acSearchAll, True, acAll, True

Thanks for any help.
 
T

TC

I have a form whose control source is a table.

Just to nit-pick, the data source of a form is its RowSource or RecordSource
(I forget which). ControlSource is the data source of a single control;
typically, the name of a field in the form's Row/RecordSource.

To pull up
a particular records on the table the criteria needs to
include three fields to uniquely identify the record. So
I want the user to select each field using combo boxes
then be able to click on a cmd button to find the
records.

If the form is bound to a table, and the user clicks the combo boxes, won't
this cause Access to think that the user has edited the current record? Are
you sure that your current approach is not actually >changing< the data in
the record that is displayed when the user clicks the combo boxes?

Here is my code that does not work:
DoCmd.FindRecord Me![cmbID] And Me![cmbTransmittal] And Me!
[Box], acAnywhere, 0, _
acSearchAll, True, acAll, True

Gak! The WHERE parameter should be something like this:

"[F1]=""" & me![C1] & " AND [F2]=""" & me![C2] & ...

where Fn is the name of a field in the table, and Cn is the name of the
corresponding control which is bound to that field.

Does that help?

TC
 

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