Clearing Checkbox

  • Thread starter Thread starter Jim May
  • Start date Start date
J

Jim May

I'm running code that Fills a Dataform <<and all fields are working fine
except for the last two items which are checkboxes: the final step should
fill in one of the two separate checkboxes on my frmPOReq, but right now
the frmPOReq is showing in some cases BOTH checkboxes checked, with one or
the other greyed out
on the form... Can someone tell me what I'm doing wrong here?

....Code before,,
If Target.Offset(0, 17).Value = "No" Then
frmPOReq.ChkNo = True
frmPOReq.ChkYes = ""
End If
If Target.Offset(0, 17).Value = "Yes" Then
frmPOReq.ChkYes = True
frmPOReq.ChkNo = ""
End If
frmPOReq.Show
End Sub
 
Jim,

I don't know what is causing the problem, there must be some code we aren't
seeing. But ...

You don't need two checkboxes. If you think about it, a checkbox is just a
switch, it is either True (checked) or not True (unchecked). Yes and no are
also different switch statuses, so use one checkbox to indicate Yes
(checked) or No (unchecked)

frmPOReq.chkYesNo = (Target.Offset(0, 17).Value = "Yes")
frmPOReq.Show
End Sub
 
First try

If Target.Offset(0, 17).Value = "No" Then
frmPOReq.ChkNo = True
frmPOReq.ChkYes = False
End If
If Target.Offset(0, 17).Value = "Yes" Then
frmPOReq.ChkYes = True
frmPOReq.ChkNo = False
End If
frmPOReq.Show
End Sub
 
Right On !! - Tks Tom

Tom Ogilvy said:
First try

If Target.Offset(0, 17).Value = "No" Then
frmPOReq.ChkNo = True
frmPOReq.ChkYes = False
End If
If Target.Offset(0, 17).Value = "Yes" Then
frmPOReq.ChkYes = True
frmPOReq.ChkNo = False
End If
frmPOReq.Show
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top