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

Passing a value to subform using a button

Status
Not open for further replies.

educate889

Technical User
Dec 4, 2002
45
US
I have a main form (unbound) and a subform (bound tblMaster_cc)

The user selects a company in Combo (cmbCompanyID) which fills in some unbound "info" fields on the form. Then they are to click a button (cmdCreateComplaint) which I wanted to pass the value of the combo box to the subform field to begin the data entry.

Here is my code for the button:

Private Sub cmdCreateComplaint_Click()

[Forms]![01_Main_Prod_Complaint]![01_cc_sub].Form!txtCompany = CboCompanyID.Column(0)

End Sub

The problem is that it works only 85% of the time. Other times I get errors and function is halted.

Can someone please help! All I want it to fill in some of the values on the subform so there is less room for data entry error.

If you think I should attack it differently, I am up for suggestions.
 
what errors do you get and when do you get them?
"What a wonderfull world" - Louis armstrong
 
Sorry for delay Chrissie . . . was traveling!!!

The error I get is

Method 'Form' of object '_subForm' failed


When I debug it points me to the line of code from above posting.
 
Did you ever manage to sort this out? I'm having the same problem.

Thanks

M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top