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!

Set value in control on subform

Status
Not open for further replies.

LakotaMan

Instructor
Aug 21, 2001
240
US
Hi All,

Though I've gotten some help on part of this routine by searching past posts,am having trouble with the second part.

Briefly:

Using Access 2003

I have a main form with a tab control and on the first page a subform. On that subform I have a button to load another form that has multiple data for user to choose from (kind of a helper aid) Once user has clicked a button on the pop-up form corresponding to the data he wants, I want to set values in two controls on the original form/subform.
I have set up public variables to hold these values once the button on the pop-up form is clicked.

I am able to set one of the values okay as it goes into a textbox, but am having trouble using the public variable to set the second piece of info, which is in a combobox that captures a number, but displays a text field (for user convenience).

Here is the code behind the button in the pop-up form:

Code:
    'Set Public Variables
    ClientCaseId = Me.lngClientCaseID
    ProgCode = Me.lngProgramID


    Forms!frmAddServiceTicket!tblServiceTickets.Form!lngClientCaseID.SetFocus
    Forms!frmAddServiceTicket!tblServiceTickets.Form!lngClientCaseID.Text = ClientCaseId
    
    Forms!frmAddServiceTicket!tblServiceTickets.Form!cboProgram.SetFocus
    Forms!frmAddServiceTicket!tblServiceTickets.Form!cboProgram.Column(0) = ProgCode

The variables are capturing their data, and the first variable (ClientCaseID) is going into it's appropriate control, but I must be messing up the syntax something serious on that second bit. Here's the error message I get:

"Property let procedure not defined and property get procedure did not return an object"

Any help you can give me will, as always, be greatly appreciated.

LM



 
How are ya LakotaMan . . .

You don't need the variables, you can set the controls directly:
Code:
[blue]   Dim frm As Form, CBx As ComboBox
   
   Set frm = Forms!frmAddServiceTicket!tblServiceTickets.Form
   Set CBx = frm!cboProgram
   
   frm!lngClientCaseID = Me.lngClientCaseID
   CBx.SetFocus
   CBx.Text = Me.lngProgram
   
   Set CBx = Nothing
   Set frm = Nothing[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Hi AceMan,

This didn't make any difference in my results. I thought it over some more and hit upon an idea last night, which I tried out today and got everything working.

Briefly, the problem is that I was trying to enter (from the pop-up form) a number value into a combo-box (on the original form/subform). Though this is what the cbo captures to the bound table, the user actually enters text, as this is easier for them to remember than the ID numbers.

I changed my code to put text in the cbo (as if user had typed it in) and this works great, still capturing the ID# to the table.

I did use your code to streamline mine. . .

As always, many,many thanks for your help. It's always good to hear from TheAceMan!

LM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top