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

Display info from subform in main form

Status
Not open for further replies.

msuguy71

Technical User
Apr 22, 2003
20
0
0
US
Hi there, I have tried to follow the various techniques to do what I am trying but have not yet been successful. Let me tell you a little about what I am trying to do. We are a non-profit ambulance service and can't afford the fancy CAD systems for dispatch so I am trying to make a simple one for now. I have designed a main form that has all of the needed information that we collect when an ambulance is sent out that is stored in the table. I then added a subform that shows 8 "calls" at one time in a continuous forms view. This subform only shows a few selected fields from the table. I have the subform showing the 8 "calls" correctly and we can navigate through them with either the navigation tools, the record control, or a vertical scrollbar. What I would like to do is to be able to click on one of the "calls" in the subform and have the information display in the main form. I have tried to use the code that is below without sucess and I have tried the master/child link relatonship in the subform. The code doesn't do anything when I click on the little gray box next the the subform record and if I use the master/child link then the subform only shows one record instead of 8, although the main form and the subform are synced then.

Also, I need to be able to add records for the system. I thought about only allowing the dispatch to navigate through the subform and be able to start a new record from there, then once the new record is created and opened in the subform I believe that the main form would show the new record as well and allow the dispatcher to be able to enter the information into the main form window (if I get the first problem solved). Will this work?

Here is the code I tried in the subform:
Private Sub Form_Click()

Dim FormName As String, SyncCriteria As String
Dim f As Form, rs As Recordset

' form name to be syncronized
FormName = &quot;Dispatch Log&quot; ' <make sure this is the exact name of your Orders form.

DoCmd.OpenForm FormName

'Define the form object and recordset object for the Orders form
Set f = Forms(FormName)
Set rs = f.RecordsetClone

' define the criteria used for the sync
SyncCriteria = &quot;[Run_Number]=&quot; & Me![Run_Number]

' find the corresponding record in the Parts table
rs.FindFirst SyncCriteria
f.Bookmark = rs.Bookmark

End Sub


Thanks...Rick
 
Ok, I found some more information on this problem and changed my code to the following:

Private Sub Form_Click()

Dim FormName As String, SyncCriteria As String
Dim f As Form, rs As Recordset

' form name to be syncronized
FormName = &quot;Test&quot;

'Define the form object and recordset object for the Orders form
Set f = Forms(FormName)
Set rs = f.RecordsetClone

' define the criteria used for the sync
SyncCriteria = &quot;[Run_Number]=&quot; & Me![Run_Number]

' find the corresponding record in the Parts table
rs.FindFirst SyncCriteria
f.Bookmark = rs.Bookmark

End Sub

This is still not working. Anyone have any ideas?

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top