Select entry from combo box if yes/no box checked (1 Viewer)

lyatri

Registered User.
Local time
Yesterday, 16:10
Joined
Dec 6, 2012
Messages
14
Hi All
I have a yes/no tick box on form this then enables two combo boxes. I also want it to change the value in one of the combo boxes. If you were to code that value as default it would be value "1". I have played around with item data and value but to no avail. Current code associated with check box is:

Private Sub FL_Trim_AfterUpdate()
If Me![FL Trim] = True Then Me![FL Lesion].Enabled = True
Me![FL Treatment].Enabled = True
End Sub

This currently works to enable the boxes but obviously not to change the value of FL Lesion.

Thanks
 

James Dudden

Access VBA Developer
Local time
Today, 00:10
Joined
Aug 11, 2008
Messages
369
Will it always be the same value? If so do this:

Private Sub FL_Trim_AfterUpdate()
If Me![FL Trim] = True Then
Me![FL Lesion].Enabled = True
Me![FL Treatment].Enabled = True
Me![FL Lesion] = 1
End If
End Sub

NOTE: You need to change the 1 to the required value.
 

lyatri

Registered User.
Local time
Yesterday, 16:10
Joined
Dec 6, 2012
Messages
14
Thanks for your reply.
Unfortunately this doesn't solve the issue when I used code:
Me![FL Lesion] = Trimmed
which is the value I want the box comes through as blank
if out on interest i put = 1 is comes up as 1
 

James Dudden

Access VBA Developer
Local time
Today, 00:10
Joined
Aug 11, 2008
Messages
369
What is Trimmed?
Is it a string, if so it needs to have quotes as follows:
Me![FL Lesion] = "Trimmed"
 

pr2-eugin

Super Moderator
Local time
Today, 00:10
Joined
Nov 30, 2011
Messages
8,494
Not sure if I could actually understand what you mean.. But by what I have understand, the choice of Event might be the problem.. Try Form Current..
 

lyatri

Registered User.
Local time
Yesterday, 16:10
Joined
Dec 6, 2012
Messages
14
Apologies as I had set field as lookup in both form and table it as interfering now works. Thanks
 

Users who are viewing this thread

Top Bottom