yes/no message box

S

Sibes

When "yes" is selected the right subform opens. When "No" is selected I need
it to place the value of "0" in check box field then move to another field
in the main form.

is there any possible way to do this? Below is a copy of the code that i
have so far. "yes" works, "No" doesnt work.

'this will let the user add family information, if no information will set
the family info to NO

Dim intResponse As Integer

intResponse = MsgBox("Do you have any family information ", vbYesNo,
"East Kootenay Realty and Insurance")


If intResponse = 6 Then
'code to execute if Yesv
intResponse = Forms![AddNew]![Family].SetFocus
Else
'code to execute if No
intResponse = Forms!AddNew
'intAnswer = 0


End If

thanks
 
T

tina

intResponse = Forms![AddNew]![Family].SetFocus
intResponse = Forms!AddNew

i don't see how these lines of code could do anything - except generate an
error from the compiler. SetFocus is a method, not an expression or function
returning a value that can be assigned to a variable. and i don't understand
why you would want to change the value of intResponse, anyway; its' purpose
is to hold the "button clicked" in the message box, which is correctly
assigned earlier in the code.

after assigning the message box response to intResponse, something like the
following code should perform as you're asking, as

If intResponse = 6 Then
'code to open the correct subform
Else
Me!MyCheckbox = 0
Me!MyControl.SetFocus
End If

the above code assumes that the checkbox control and the other control are
on the same form that the code is running from. if not, please describe your
setup and process in more detail.

hth


Sibes said:
When "yes" is selected the right subform opens. When "No" is selected I need
it to place the value of "0" in check box field then move to another field
in the main form.

is there any possible way to do this? Below is a copy of the code that i
have so far. "yes" works, "No" doesnt work.

'this will let the user add family information, if no information will set
the family info to NO

Dim intResponse As Integer

intResponse = MsgBox("Do you have any family information ", vbYesNo,
"East Kootenay Realty and Insurance")


If intResponse = 6 Then
'code to execute if Yesv
intResponse = Forms![AddNew]![Family].SetFocus
Else
'code to execute if No
intResponse = Forms!AddNew
'intAnswer = 0


End If

thanks
 

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

Top