Access a record in a subform

Somebody

Registered User.
Local time
Today, 15:15
Joined
Apr 30, 2008
Messages
16
hi

i learned acces by myself so there are thing i really don't know how to do :
i'm trying to get the information in records in a subform so i can put all the data of the record in differents textbox in my form. By pressing a button, the info of the selected record in the subform would be put in the corresponding textbox in the form.
My problem is that i dont know what to call to get access to the different fields of the selected record in the subform...

thank you in advance for this little piece of wisdom
 
hi,

the form uses combo box and text box to find a type of euipement and then these items are stored in a table. The subform, wich is in the same form as the one to add item into the table, is mainly composed of a query that shows all the items depending of the combo box.
what im trying to do is make a button that takes the fields of the selected item in the subform and put that info into text box in the form.
I just dont know what to call to get the info of the record that is selected in the subform.
is that possible?

thank you
 
hi,

it dosen't seem to work with that approch
or i just dont understand how to do it
or i didnt explained well how is my form/subform

My subform refer to a query (source object = Query.QueryName )
so there are no controls in my subform, just fields like in a datasheet

i included a picture of how my form looks, it may help to find a solution.
The sub form is at the bottom and by clicking a button at the right, i wnat to copy the info in the fields in the text box just above.

thanks for your support
 

Attachments

  • form.GIF
    form.GIF
    19.6 KB · Views: 122
Those "fields" are controls and they all have a name. In design view, right click on one and select "properties" to get the control's name. Then do what Pat said.
 
wow thx George Wilkinson

it helped me understand a few things but when i try to write the line pat gave me,
the controls names do not show and if i put it anyway i get : " compile error : Method or data member not found"
i used "Me.SubformName.Year" where 'year' is the control name as found by your advice ( thanks by the way)
Do i have to select something else from the 'list properties/methods' menu and then ill be able to get the control name ?
 
You cannot use the word "SubformName". Pat's intention was for you to find out your subform's name and put it there. You can get the sub-form name by right clicking on the outline of the subform and selecting properties.
 
Here's an easier approach:

In query builder for your query, right-click on the criteria where you want to select info from the subform, then click "Build..."

You will then get the Expression Builder dialog. On the bottom left pane, click thus:

Forms -> Loaded Forms -> YourFormName -> SubformName -> ControlName.

Double click it to get the full string in the top box, then click OK and now your query will know where to find the data in the subform's control.
 
George, don't worry i didn't use SubformName as the name of my subform, its just that the name was long and complicated so i put an example to simplify things

banana, i tried that put nothing appears in the middle and right box of the Expression builder when i select my subform. in the form i can see every box and the other controls, so thats normal

and thats my problem, the subform seems to be empty but if i go in design mode, i can see the text box with the name and everything. I just cant access it in Access or with some code

thanks
 
Is subform's recordsource set? What about child and master link? (In Properties Window, under Other tab)
 
the Source Object of my subform is " Query.qfltSubEstimation "
"qfltSubEstimation " is the query in the subform
and the child and master link fields are empty (in the "data" tab...)
 
That's why- you need to fill in master and child field in order to tell Access how to handle the subform. Click the ... Button to right and set the fields to the keys so it will work properly.
 
It tells me that i can't build a link between unbound forms when i click the ... button
 

Users who are viewing this thread

Back
Top Bottom