Microsoft Office Tutorials and References
In Depth Information
Triggering a New Form Based on a Subform Selection
Figure 83 – Sample Update Form
These forms look familiar, even though the datasheet subform sfrmName is a
new element. This is placed on the form by using the subform button from the
toolbox in design mode. This launches a wizard that asks which table/query
and which fields from the table/query are to be included.
Enter the form name and press Finish. A subform with the entered name is
added to the Forms tab of the database window. Next, add the Update button
and name that btnUpdate before opening the OnClick event in which to place
the following code:
Private Sub btnUpdate_Click()¶
' Open form frmNameUpdate and pass the ID from¶
' the active row of the subform¶
DoCmd.OpenForm frmNameUpdate, , , [ID]= & Me.sfrmName.Form.ID¶
End Sub¶
Acs
When typing the commas behind the frmNameUpdate, note that Access does
show the appropriate parameter that needs to be entered. The one used here is
called the WHERE condition. Pass a string that is a concatenation of the name
of the field and the value it should have, such as:
[ID]=1
The same string could be used in a query to extract this row, such as:
SELECT * FROM tblName WHERE [ID]=1
The nice thing about this is the fact that the frmNameUpdate can be built
without knowing which row to display, because Access uses this string to filter
 
Search JabSto ::




Custom Search