Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does this mean?

Status
Not open for further replies.

chestyxbond

Technical User
Oct 1, 2001
18
US

I'm making a command button to open another form using the Wizard. One of the options is "Open the form and find specific data to display," but I'm not quite sure what this option does.

The button I'm making goes on a form in which the user adds a new record to the database, and the button will open a new form that has a few subforms on it. On the new form that opens, there is a combo box that you use to find the record you want to edit.

Now, what I'd like to happen, is that when you click on the button that opens the new form, it automatically find the record that you were on in the first form (the same way one would find it in the combo box) and display all of that record's information. It seems like this is what the option described above should do, but it doesn't seem to be doing that (unless I have to manually tie every single field together in the forms using the next page in the Wizard).

So, what's going on here? Is this the way to accomplish what I want to do, and if not how should I go about this?

Daniel
 
I have never used that wizard option before so I don't know what it does but here is the code you need to put in your button click event to open the form to the correct record:


Criteria = "[Members SSN]= '" & Me![Members SSN] & "'"
DoCmd.OpenForm "new form name", , , Criteria


The Criteria string should be worded the same as a where clause in a query. Just build whatever criteria you need to identify the appropiate record. Maq B-)
<insert witty signature here>
 

Well, the only criteria I really need is the field InvestorName, since that's the primary key. Do I really need all that other stuff?

Also, the form I'm opening is called &quot;Edit/View Investor Info&quot; -- it's a clunky name, I know, but I didn't know much about access when I started this database (and I still don't know that much about Visual Basic, so you have to pitch pretty low when you're talking about that).

Daniel
 
Hi ,
Not a very good primary key either but anyway.. that wizard is saying what two primary keys do you want to match when you open the next form exactly what you are trying to get done.
So to use it there should be an investorName in the recordset for the first form and in the secondform. Use the wizard to match those 2 together.
That will work well for view and edit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top