Crazy Access - text/combo box references

scottm91

New member
Local time
Today, 17:53
Joined
Sep 19, 2011
Messages
9
I have a form (a switchboard) that has a combo-box from which the user selects a salesperson. Other controls then reference that form to generate the appropriate filter. Well, that didn't work consistently, so I created a text box that references the combo box. Then had all the controls reference that text box. That seemed to work fine. Sometimes. Sometimes (like now!) Access just refuses to recognize that variable and gives me the #Name? message where it did repeat for me the salesperson variable chosen so I'd know it was working. And then, eventually, it works again. I have no idea why. It's driving me nuts. Any insight is much appreciated!
 
I can reference the combo box directly - sometimes. And when that doesn't work I create a mirror text box to do it. And when that doesn't work, I go back to referencing it directly. It's nuts. And it's only in the mdb - not the executable. It makes NO sense!
 
So with regards your initial approach, how did you set it up? What was the code you were using?
 
As vbaInet said, we simply have to see your code!

If the referencing is being done in the code module of the form the combobox resides on, the only thing I can see causing this kind of behavior would be if you were using something like Me.ComboboxName.Text instead of Me.ComboboxName.Value or simply Me.ComboboxName.

In Access VBA, using the Text Property, you can only reference a Control if the Control has the Focus when referenced.

Using the later two examples above, you can reference the Control at any time, whether it has Focus or not.

If you were referencing the Combobox on FormA, say, from code in FormB, then FormA would have to be Open.

Linq ;0)>
 
I'm not using any code. Just simple references. To reference the value of the combo box which selects the salesperson I'm just using the control name [SalesOpt]. But I figured something out yesterday - when I open the form on my PC it never works. What I have to do is create a text box that mirrors the control (call is [SalesOpt1] and make its value =[SalesOpt]) which works. Then I'll delete [SalesOpt1], go back to referencing [SalesOpt] as usual, and it's fine. Craziest thing. Not using any VBA on this portion nor is this control referenced in any VBA. And all these references are on the same object/form.
 
Maybe your form or controls are corrupt.

Can we see the database you're referring to? Obviously mention which the problem form and controls.
 

Users who are viewing this thread

Back
Top Bottom