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

Passing Arguments between forms

Status
Not open for further replies.

LJtechnical

Technical User
Aug 7, 2002
90
GB
I am trying to pass two arguments from a list in one form to two fields in another form. Whilst doing this I wish to close the first form. I have set about trying to do this by using the record selectors but until now have been very unsuccessful. Is this possible??

Cheers
Dave
 
I can't quite understand eveyrthing that you're tyring to do without more explanations.

But have you tried making 2 public variables in your second form, and when the list selection changes in the first form, have them change the values of the variables in the second form?

But can I have more details about the exact problem you are encountering?
 
I have a subform displaying a list of products (module name and number) the list on the subform is determined by a field in the main form. I have placed a button that appears next to each list item and i want it to close the form and pass the module name and number to another form on opening. I am trying to make the following code work, but i get error message saying cant find Products form. I think this is due to it being a subform.
___________________________________________________________

Private Sub Command18_Click()
On Error GoTo Err_Command18_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "NewModule"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms![Products]![ModuleNumber] = Forms![NewModule]![ModuleNumber]
Forms![Products]![ModuleName] = Forms![NewModule]![ModuleName]

Exit_Command18_Click:
Exit Sub

Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click

End Sub
 
Oh OK. So you want to access something on the subform....You have to reference the subform as being a subform. Like [Forms]![MainForm]![Subform]![Control]. It might be [Forms]![MainForm_subForm]![Control].

I think that's how you do it. Its been a long time since I've done that. Try that, and look in help too, thats where I found it (although it took some digging to find it).

 
Cheers for that , got there in the end with a little tweek here and there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top