By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,495 Members | 1,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,495 IT Pros & Developers. It's quick & easy.

What's wrong with this MsgBox code?

P: n/a
Here's all of my code...

Private Sub Submitted_Click()
On Error GoTo Err_Submitted_Click
DoCmd.SetWarnings False

MsgBox("Have you ensured that no errors are present in the data?", 4,
"Are you sure?") As VbMsgBoxResult
If VbMsgBoxResult = 7 Then GoTo Exit_Submitted_Click

Dim stDocName As String

stDocName = "Mark as Submitted"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Submitted_Click:
DoCmd.SetWarnings True
Exit Sub

Err_Submitted_Click:
MsgBox Err.Description
Resume Exit_Submitted_Click

---------------------------------------------

I'm getting a problem with:
MsgBox("Have you ensured that no errors are present in the data?", 4,
"Are you sure?") As VbMsgBoxResult

The error reads:
Compile Error:
Statement invalid outsite Type block


Any suggestions? I'm kinda new at this whole VB thing so I've been
grabbing from a lot of sources.

Thanks,
Andrew
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Change

MsgBox("Have you ensured that no errors are present in the data?", 4,
"Are you sure?") As VbMsgBoxResult
If VbMsgBoxResult = 7 Then GoTo Exit_Submitted_Click
to this

If 7 = MsgBox("Have you ensured that no errors are present in the data?", 4,
"Are you sure?") Then GoTo Exit_Submitted_Click

--

Ken Snell
<MS ACCESS MVP>
"Andrew" <sp****@gnt.net> wrote in message
news:d8************************@posting.google.com ...
Here's all of my code...

Private Sub Submitted_Click()
On Error GoTo Err_Submitted_Click
DoCmd.SetWarnings False

MsgBox("Have you ensured that no errors are present in the data?", 4,
"Are you sure?") As VbMsgBoxResult
If VbMsgBoxResult = 7 Then GoTo Exit_Submitted_Click

Dim stDocName As String

stDocName = "Mark as Submitted"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Submitted_Click:
DoCmd.SetWarnings True
Exit Sub

Err_Submitted_Click:
MsgBox Err.Description
Resume Exit_Submitted_Click

---------------------------------------------

I'm getting a problem with:
MsgBox("Have you ensured that no errors are present in the data?", 4,
"Are you sure?") As VbMsgBoxResult

The error reads:
Compile Error:
Statement invalid outsite Type block


Any suggestions? I'm kinda new at this whole VB thing so I've been
grabbing from a lot of sources.

Thanks,
Andrew

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.