Using OpenForm macro to open a subform to a specific record

  • Thread starter Thread starter Shell
  • Start date Start date
S

Shell

Guest
Hello, fantastic site you have here!

I have a form based on a table called TermWithPaysStoredData that shows a single row for everyone in the table with a small amount of info from the table and has controls for a user to enter dates which writes to that same table.

I have a subform that reads that same table but has much more information about each row. I would like to add a button to each row of the main form that says "More Info". When clicked, it should open the subform to the same employee.

The field I want to match is called ID. My main form is called fTermWithPays and my subform is called fTermWithPaysMoreInformation.

I tried using the OpenForm method but that either opens the form to the first record or filters and shows only one blank record.

I'd like to use a macro for this if possible because I don't know VB.

Any ideas? Let me know if more explanation is needed.

Thanks very much!
 
Thanks very much! I was just coming back to post that I found the answer. I was trying to make it way too complicated! All I needed to do was use the wizard. Here is what I did in case anyone else needs it and doesn't understand vb:

Create a command button using the Wizard. In the first screen of the Wizard select "Form Operations" and then select "Open Form" in the right list box. Click the Next button. Select the form you want to open and then click Next. In the next screen select the radio button that says, "Open the form and find specific data to display". In the next screen select ID in both list boxes and then press the little button between the two list boxes. Click next and then select what you want your button to look like, then go to the last screen and name your button.

voila! can't believe I wasted that much time on something so simple!
 

Users who are viewing this thread

Back
Top Bottom