0
votes

I have a form FRMSOCIALGRAPH. In the form I have a subform FrmSGSystems. On the subform I have a list box - Systemlist (1 column)- with multiple values. On clicking of a value I would like a query to run specific to the value on the list box. Plan was to pass a value onto the main form in a Txtbox, and then use the value of the Txtbox in my query criteria.

I cannot get the reference from the list box though into the Txt box. The code that I have is:

Me!SystemLookup = Forms.frmsocialgraph.FrmSGSystems.Form.Systemlist.Column( _
    0, Me.Systemlist.ListIndex)

I suspect that it is something to do with how I reference my forms and sub forms. If anyone is able to assist I would appreciate it.

First error message is that it cant find the field SYSTEMLOOKUP which is the text box on on my form FRMSOCIALGRAPH and I want to move the value into the text box.

Thank you

2

2 Answers

0
votes

Since it has only one column, you can use its Value property. However you don't have to copy the value to a textbox in order to use it your query.

To access the value from your query:

Forms!MainForm!SubForm.Form!ControlName

In your case:

Forms!frmsocialgraph!FrmSGSystems.Form!Systemlist

You can also set the above as a parameter to the query exactly as shown above and define its data-type.

0
votes

Use

Me.Parent!Textboxid.value = Me.Systemlist.Column(0, Me.Systemlist.ListIndex)

from your sub-form