Message box code won't close the other form and open a new one

isaacski

Registered User.
Local time
Today, 04:00
Joined
Nov 30, 2012
Messages
67
Hi All,
I'm probably missing something really simple here but I can't seem to figure this out. I have the following code that takes place on the form frmmaster1. I want to open the form Trends and close frmmaster1 if the answer to the box is yes. It works to open trends but it seems every which way I tweak the code, I get errors... thoughts?

If Me.Score > 0 And Me.Score <= 0.99 Then
If MsgBox("You have recorded a score. Would you like to open the Trend Tracker?", vbYesNo, "Trend Tracker Prompt") = vbYes Then
DoCmd.Close "frmmaster1"
DoCmd.OpenForm "Trends"
End If
End If
End Sub

I would appreciate the help!!

Thanks!
 
Change this:

DoCmd.Close "frmmaster1"


to this

DoCmd.Close acForm, Me.Name, acSaveNo
 
I tried both ways and Fitz's way seemed to take... I kept getting an error stating that the data member couldn't be found or some such nonsense but when I used the same "member name" on fitz's suggestion it worked... I'm assuming there is something ary with my report name, being referred to as something else somewhere thats making it confused...

either way, thanks for your help!!

Kim
 

Users who are viewing this thread

Back
Top Bottom