pa*******@gmail.com wrote:
I have a combo box in which a user can select a number of "1" or "0".
if the user selects "1" it changes the visible property on other
controls that were initial set to "Flase" to "True" .
the code works until i added the set focus.
why do i get this the runtime error? it says it cannot move the focus
to the control.
the cboVehicleLog IS enabled and NOT locked
here is my code:
If tester = "1" Then
cboVehicleLog.Visible = True
cboFleet.Visible = True
cboVehicleLog.SetFocus
End If
Hmmm, a couple of wild guesses without seeing everything else...
Is the name of cboVehicleLog the name of your control *and* your
datasource? If thats the case then VBA will have some issues as to
which it's addressing. The cbo prefix you have on there probably
indicates this isn't the issue.
Also, when exactly are you changing the cbovehiclelog field to
invisible? You said that it was initially set to false, but I don't see
the 'Else cboVehiclelog.visible = false statement. Do you have that
somewhere else? Are you SURE the error is occuring at the INSTANT you
set the fields focus or is it perhaps at a different time, say a time
when you set the cboVehicleLog to invisible? An invisible field can't
have the focus.
My 2cents