IF THEN ELSE CODING missing a step

C

Curtis

I am using the following lines of code and I can not figure out why it is
completely skipping the VBNO DOCMD. Is this worded incorrectly?

Function Another_Record()

MSGBOX "Do you wish to do another LRU update?", vbYesNo, "LRU UPDATE"

If vbYes Then
DoCmd.GoToControl "Serial Number"
Else
DoCmd.Close acForm, "EDIT CDS LRU ASSET"
End If
End Function
 
J

Jeff Boyce

Curtis

As I recall, you might need to use something more like (untested):

If vbYes = Msgbox("Do you wish...", vbYesNo, "LRL ...") Then
Me!txtSerialNumber.SetFocus
Else
...

This assumes the code is running inside a form (hence the use of "Me!"), and
that you are referring to a control named "txtSerialNumber" (If your actual
control name has a space, this could cause problems. If your actual control
name matches the field name from the table, Access might get confused about
which one you're referring to.)

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 

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