Help With MsgBox

G

GHawkins

We're running Access 2003, SP2. I have a database with the following code:

Private Sub cmdSaveClose_Click()
Dim response As Integer

On Error GoTo SaveErr

If (Month(Acct_Period) <> Month(Now())) Or (Year(Acct_Period) <>
Year(Now())) Then
'Dim response As Integer
response = MsgBox("Warning: You entered a non-current month date in
the billing period field. Save anyway?", _
vbInformation + vbYesNo, "Possible Entry Error")
If vbNo Then
Me.Acct_Period.SetFocus
Exit Sub
End If
End If

When the MsgBox pops up, regardless whether I pick Yes or No it goes through
the "If vbNo Then" code as if I had selected No. If I change it to "If vbYes
Then", this section will also run as if I had selected Yes - even when I
select No. I don't know if this code is correct. The problem is, someone else
developed this database and has since left the company. The user said that
this used to work, but I know none of the code has changed. Any ideas as to
what I'm doing wrong? Please let me know if you need more information.
 
G

GHawkins

I thought it was something like that, but I'm still new to VB so I wasn't
sure if I was on the right track. Anyway, THANK YOU!!! It works like a charm
now!
 
Top