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!

Sub form to select record on Main Form 2

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
Might sound swings and round abouts but i have a form based on a table which contains trading infomation

ON the main screen of the form there is the fields for that current record, also there is a filter option to allow you to filter by trading system so you can scroll through all the records relating to that system., Thats all fine on from the main form i have a sub form which contains all the infomation in the infomation in that table relating to that Trading system. the idea is that instead of the user have to scroll through hundreds of records to find hte one they want they can simply click on the one in the sub form and that will bring it back to the main form.

so kind of

on the click of the sub form the main form active record becomes that record


note: i have simplified the above for lenghty reasons i cant use a list box.

Chance

 
I did this same thing for a lot of my database programs. I'm not sure if your asking how to do it or that your having trouble loading the item from the subform to the main form but I'll take a guess that your having problems with forcing the main form to go to the correct record.

First of all you have to have both the subform and the main form draw their data from the same recordset, query, or SQL. So that when you click on the subform the Me.CurrentRecord will match the same information on the main form.

You may be able to put this code in "OnCurrent" on the subform but I usually use the Click event of the subform. Then let the users click on the record selectors to activate an item.

DoCmd.GoToRecord acDataForm, "YourMainForm", acGoTo, Me.CurrentRecord

If your main form is using a different recordset then the subform you will have problems selecting the correct item as CurrentRecord is the absolute value of that item in it's current recordset.
 
Hi, Chance!

private sub Form_Click()
.... do what you need
forms!MainForm!ControlOnMainForm.setfocus
end sub

I think better is to use DoubleClick event for selection of subform's record.

Aivars
 
thanks

as its friday here is things you never thought you would see on the web


Number 10483# Evil Nun Relaxing


Cheers


Chance

fireplace.html
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top