Dropdown selection over button (1 Viewer)

stu_c

Registered User.
Local time
Today, 19:33
Joined
Sep 20, 2007
Messages
489
Hi all
I have a button that when clicked i want it to put YES or no in a combo box that then unhides other fields, I have managed to get it to work manually when selecting the yes or no dropdown but doesn't seem to work when I get VBA to select it via a button seems like although its showing the selection its not recognizing it any suggestions


Code:
If [Forms]![FRM_TBLALL_FullCarDetails]![CarFuelType] = 3 Then     
[Forms]![FRM_TBLALL_FullCarDetails]![CarFuelType].[Form]![Electric] = "YES"
FUNC_ElectricCar

End If
End Function

Do I need to do an enter / refresh code in vba?
 

Minty

AWF VIP
Local time
Today, 19:33
Joined
Jul 26, 2013
Messages
10,355
Altering a value in VBA doesn't trigger any events associated with that control.
If it did it would be very easy to get things stuck in a loop where control A updated Control B which updated control A etc. etc.

You can however call the event if it's made public, generally speaking though, this indicates a poor programming structure.
Better would be to have a process that was general to hide/unhide the controls and call that from wherever you needed it.
 

Sodslaw

Registered User.
Local time
Today, 12:33
Joined
Jun 7, 2017
Messages
81
will something like this help to solve your issue?

Code:
the action on click event of your toggle button
if me.tglbtn = true then
    me.cboYesNo = "Yes"
    me.textboxes.visible = true
else 
    me.cboYesNo = "No"
    me.textboxes.visible = False
end if
 
Last edited:

Users who are viewing this thread

Top Bottom