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

Select record on subform and display is on the main form?! 1

Status
Not open for further replies.

Thijs

Technical User
Nov 24, 2000
31
NL
Hi,

I have a table named Printers. Now, I have created a form called Printers. On this form there is a subform show all the Printers I have. But when I click on a record in the subform the data in the mainform doesn't change.

I have searched this forum and tried some coding. But everytime I try to run the code it says:"Compile error, method or data member not found."

An example of the code I used is the following. Can anybody tell me what I am doing wrong since I am fairly new to VB.

Thanx in advance,

Thijs Kromhout
The Netherlands.

The code:
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;frm-Orders&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;[Ordid]=&quot; & Me![Ordid]

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

End Sub
 
Hi

What about turning it on its head? I mean create a form (no recordsource) and have a list box listing your printers create a subform with the printer details on linked to you list box, then you select the printer in the listbox the subform will automatically up date?

Just a thought

Cheers

Chris
 
Well, the thought was nice, but it wont work I am afraid. Any other ideas?

Thijs
 
Thijs

How come it wont work?

Are you trying to list prints, select one and then display details from your table?

Chris
 
Chris,

Well...too early reaction of me...I got to work! :) But...how do I fix it without a list box but with a form and a subform?

Grts,

Thijs
 
Thijs

Sorry Bad morning myself so I was little quick of the mark myself.

Do you know how to link the form and subform. I can always send you a test db with an example of the list box and subform you can always change it then to suit your'e needs

Chris
 
Chris,

Well then goodmorning to you!

I would really appreciate it if you could send that db to me :)

Well, linking a form and a subform. I do not exactly know how to do that! So what I want now is that when a record is clicked in the subform. The data in the several field on the main form have to change to the chosen record.

Grts,

Thijs Kromhout

ps: email= thijskromhout@duvak.nl

Thanx in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top