How to do this: either enter as new or search for existing?

E

Ed from AZ

I don't know if this is the correct approach, but this is the idea
I've got:

A form will have a few controls to enter some data and two buttons.

One button is "Enter as New Record" - this one opens a subform for the
table with the initial data entered in as a new record and the other
fields available for data entry.

The other button is "Find Matching Record" - this one creates a
variable to go into a SELECT statement to search the table for a
record that matches the entered data, and then opens a subform to show
that record and other fields for data entry.

In playing around with this unsuccessfully, I noticed that the
CommandButton wizard has a preset function to go to the new record
field. It seems to want to go to the new record field of the form's
record source, though. But the form is built on a query to the table,
right? So I would have to direct it to the new record field of the
table, and enter the data in the form into the appropriate fields.

I have a sample database for the SELECT code, and I think I can make
that work. But that will return my data as a query result, right? I
would need to pull up this record because I have more data to enter,
so I need to show it in a data entry subform based on the table so I
have the additonal fields, yes?

Can someone venture to drop-kick me in the proper direction? By
chance is there a tutorial or a sample database that I can look at for
this?

Ed
 
E

Ed from AZ

Okay - I managed to cobble together a workable search and show.

The Add is giving me problems, though. I got the
DoCmd.GoToRecord acDataTable, "tabPartsInstl", acNewRec
in the button code, but I'm having difficulty finding the proper code
to gather my entered values and write them into the new record fields
of my table. Any examples?

Ed
 
E

Ed from AZ

Found some ADO code, and it works.

Thanks to all who have posted on this NG and the various web sites.
That's where I have found everything. You all are great for sharing.

Ed
 

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