Use a command button on main form to open a 2nd form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In Access, I have an events form that has multiple records for a location.
Each record on the main form has a command button. I would like to be able
to click the command button next to a specific record on the main form and
open a 2nd form that will display the same record for editing. I can get the
2nd form to open by clicking the button which does display a record for the
correct location but it doesn't display the same record that was selected
from the main form. The fields on the main form that I need to use the match
to open the 2nd form are property id, event date and event type. All 3 need
to be used to find the correct match on the 2nd form.
 
If you run the command button wizard, it should walk you through this.
You just have to select the fields that you're matching on. If you're
doing it manually, you would do something like

dim strFilter as string
strFilter = "[propertyID]=" & me.txtPropertyID & " AND [eventDate]=#" &
Me.txtEventDate & "# AND [EventType]='"& me.txtEventType & "'"
docmd.OpenForm "FormName",...,strFilter
 
Back
Top