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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using cmd buttons to open sub-forms

Status
Not open for further replies.

NeilPattison

IS-IT--Management
Aug 24, 2005
52
GB
I am working on a database to hold the data regarding our company vehicles. I have a table for the details of the vehicle (i.e Registration, VehicleType, Drivername etc) and a number of tables for different types of equipment (AccessEquipment, LiftingEquipment, StandardEquipment and others).

I have a form that runs on a query with the criteria to search for the registration number. I have also set up forms to show each type of equipment to use as sub-forms. I would like to have on this main form a number of command buttons that would open the specific sub-form on the main form.

How can I do this? Any ideas would be greatly appreciated?
 
The easiest way to do this would be to use the command button wizard in your form designing.

* Form Operations > Open Form
* frmFormThatYouWantToOpen
* Open the form and find specific data to display
* Then select the fields that link the tables.

Sam


It's just common sense, shame sense isn't common!
 
Here is one i've done:-

rivate Sub ViewTourOperatorFormDetails_Click()
On Error GoTo Err_ViewTourOperatorFormDetails_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmIndividualCompanyDetails"

stLinkCriteria = "[ATOL]=" & "'" & Me![ATOL] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_ViewTourOperatorFormDetails_Click:
Exit Sub

Err_ViewTourOperatorFormDetails_Click:
MsgBox Err.Description
Resume Exit_ViewTourOperatorFormDetails_Click

End Sub

It's just common sense, shame sense isn't common!
 
How are ya NeilPattison . . .

If your talking true subforms (forms embedded on another), they'll always be open.

Manipulate the [blue]Visible[/blue] property properly!

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top