VBA COmmand Button Code not working

rhyslewisdavies

New member
Local time
Today, 08:16
Joined
Mar 11, 2015
Messages
6
Hi all, I have a command button that when pressed needs to check the value in a field and then make a text box visible if the field has an appropriate value.

here is the code - the VBA editor doesn't throw any errors when I click the button but the text box doesn't display. if i misspell the field value in VBA then it does thrown an error so the code should work and its very simple.

If Me.weekcommencing.Value = "monday" Then Me.sixteenth.Visible = True

Any ideas!?

Thanks

Rhys.
 
Are you sure the Me.weekcommencing contain a value = "monday"?
Put in a message box in you code.
Code:
MsgBox(Me.weekcommencing)
 
Hi there - I should have mentioned that its referencing the value that is selected in a dropdown field. if I create a text box and enter the same value in as free text and hit the command button then it works. but I cant work out why that should make any difference?

Thanks

Rhys
 
OK - so it needed the ID of the dropdown field value - thanks for helping me down the correct path!
 

Users who are viewing this thread

Back
Top Bottom