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

Refer to a text box on a form from a combo-box 1

Status
Not open for further replies.

NFI

Programmer
Jun 7, 2000
278
GB
Hello,

a bit convoluted this one, but I suspect I'm just doing something stupid...

I'm putting together a form which generates a selection of random values in text boxes, based on the content of a combobox (also on the form). One of the text boxes, though, requires only a yes or a no and I'm trying to generate that value as follows;

Code in the After Update event of the combo-box:
Code:
Text16.[Value]=IIf(Int(Rnd()*10)>5,"yes","no")

The idea being, when you change the combo-box value, the value in Text16 is set randomly to yes or no. Unfortunately, it won't work, as I keep getting the error:

Code:
Microsoft Office Access cannot find the macro 'Text16.'

I've tried referring to Text16 as [FormName]![Text16] and as [Forms]![FormName]![Text16] but I get the same error, saying that the first object (i.e. FormName or Forms) macro can't be found...

I'm sure this is down to me not knowing how to refer to objects on a form properly, so if anybody can help out, I'd be very grateful.

Thanks,

Paul
 
Code in the After Update event [!]procedure[/!] of the combo-box

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That is the after update event procedure, there isn't any other code...I've cut this straight from the After Update event in the combo-box properties dialogue box...

...I'm getting the feeling I'm not doing something right, here...

Paul
 
The After Update event in the combo-box properties dialogue box should be <event procedure> and then you click the ellipsis (...) to put the code in the [!]procedure[/!] body.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Oh I see...

I'd just coded straight into the dialogue box...

I feel such a noob :(

Thanks for the help,

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top