msgbox help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form where certain fields disappear or appear depending on whether
you check the March2006 checkbox or the July1999 checkbox. The checkboxes
are form-based since I only need to store the information, not what form is
used. There are two different reports being created off this one form and
they differ slightly depending on the version of the form so that's why I
have these options.

I would like a message to pop up when you open the form to ask if you would
like to use the July 1999 version of the form and if you choose no, the March
2006 version is selected.

I am a newbie at access and visual basic so this is probably crude code, but
it's all I've been able to come up with.

If MsgBox("Do you want to use the July 1999 Form? If no, the March 2006
Form will load.", _
vbDefaultButton1 + vbYesNo) = vbYes Then
July1999.DefaultValue = "Yes"
March2006.DefaultValue = "No"
Else
July1999.DefaultValue = "No"
March2006.DefaultValue = "Yes"
End If

I placed this under Form Open, but the message box came up regardless of
whether I was going to an old form or opening a new one. I put it in form
current, after update, and before update and it still did now work how I
wanted. I feel like it may be because I'm choosing DefaultValue instead of
Value, but I received coding error with my visible codes when I tried it with
Value.
 
The code looks right, but I think you need to first determine whether
you even want to launch it.

I don't think I understand the process, because you're prompting the
user to see which form they want to use, and then you're giving them a
form with checkboxes for each form? And then you said the messagebox
popped up regardless of which form you used? I must be
misunderstanding that.
 
Back
Top