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!

mainforms and subforms 1

Status
Not open for further replies.

Lhuffst

Programmer
Jun 23, 2003
503
US
Hi I'm trying to pass a value from a mainform combo box to a subform text box.
When the form first loads it works fine (thanks to help from this forum) but when I add that same code to the after update
on the combobox I get an error message

[bold]438 Object doesn't support this property or method[/bold]

Here is the code I used
Code:
Forms![frmMainTab]![frmReports].Txtcboselected = Me.cboLookUp.Value

Where cbolookup is on the mainform and txtcboselected is a textbox on the subform.
I've tried a lot of variations on the syntax and keep getting the same message.
Any one see what I"m missing?

I also tried to use tempvar!tvUser and it works on the main form but I still can't pass the value to the subform.
Thanks in advance
Lhuffst
 
What about this ?
Me!frmReports.Form!Txtcboselected = Me!cboLookUp.Value

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Same error. Am I putting it in the wrong place logically?
 
When your form is open, you can open the debug window (press Ctrl+G) and then test the expression:
Code:
? Forms![frmMainTab]!cboLookUp

Code:
? Forms![frmMainTab]![frmReports].Form!Txtcboselected

If the objects are all named correctly this should give you a value. Make sure you use the Name of the subform and not the Source Object since they could be different

Duane
Hook'D on Access
MS Access MVP
 
When the form first loads it works fine (thanks to help from this forum)Here is the code I used
Forms![frmMainTab]![frmReports].Txtcboselected = Me.cboLookUp.Value

Either you typed that code wrong, or what you think is working is not really working. My guess is the latter, because that code will not work as already pointed out. That error message is correct
438 Object doesn't support this property or method
Because a subformcontrol cannot have a property or method called TxtCboSelected. The subform control can have a form with the property TxtCboSelected.

If that code is also in your load event then the code is probably not firing or it would give you the same error.
 
Thanks all. It's working now. Once I changed my code to PHV's suggestion, I had come up with another error and fixed that error. Now it works fine. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top