Subform

  • Thread starter Thread starter David
  • Start date Start date
D

David

I have created a Form with a Combo Box and a Subform.
When I select a Horse's name from the Combo Box all the
revelant form lines are displayed in the Subform.
The Combo Box and Subform are linked by the Horse's name
which works perfectly.
What I would now like is to be able to click on any form
line on the Subform and the full race result would be
displayed which is on another form in the Database.
Almost forgot the Subform and the Race Result would be
linked by the RaceID.
Can anyone help please
Thanks
 
I have created a Form with a Combo Box and a Subform.
When I select a Horse's name from the Combo Box all the
revelant form lines are displayed in the Subform.
The Combo Box and Subform are linked by the Horse's name
which works perfectly.
What I would now like is to be able to click on any form
line on the Subform and the full race result would be
displayed which is on another form in the Database.
Almost forgot the Subform and the Race Result would be
linked by the RaceID.
Can anyone help please
Thanks

It would be simplest to put a Command Button on the form, with code
resembling this:

Private Sub cmdOpenResult_Click()
Dim strSQL As String
strSQL = "[RaceID] = " & Me!RaceID
DoCmd.OpenForm "RaceResults", WhereCondition := strSQL, <optional
parameters, read the documentation>
End Sub

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
-----Original Message-----
I have created a Form with a Combo Box and a Subform.
When I select a Horse's name from the Combo Box all the
revelant form lines are displayed in the Subform.
The Combo Box and Subform are linked by the Horse's name
which works perfectly.
What I would now like is to be able to click on any form
line on the Subform and the full race result would be
displayed which is on another form in the Database.
Almost forgot the Subform and the Race Result would be
linked by the RaceID.
Can anyone help please
Thanks

It would be simplest to put a Command Button on the form, with code
resembling this:

Private Sub cmdOpenResult_Click()
Dim strSQL As String
strSQL = "[RaceID] = " & Me!RaceID
DoCmd.OpenForm "RaceResults", WhereCondition := strSQL, <optional
parameters, read the documentation>
End Sub

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
.
Hi John
Thanks for your help.
Tried your suggestion but error message "Compile error
invalid use of Me keyword appears. I,m sorry but not very
familiar with VBA procedures. Anymore help would be
appreciated.
 
Thanks for your help.
Tried your suggestion but error message "Compile error
invalid use of Me keyword appears. I,m sorry but not very
familiar with VBA procedures. Anymore help would be
appreciated.

It sounds like you might have tried to put this code in as a new
Module on the Modules tab; that wasn't my intent. Instead, create a
new Command Button on the Form; view its Properties; click the ...
icon by the Click property; invoke the Code Builder. Access will give
you the Sub and End Sub lines. Copy my code (with any changes of names
needed for your database) in between, without of course repeating the
Sub or End Sub lines.

Note that I'm assuming you're using an Access Form object - if you're
using an ASP Page, please post a new thread mentioning that fact; I'm
not skilled in that area and it is quite different.

John W. Vinson[MVP]
 
Back
Top