473,465 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

What's wrong with this MsgBox code?

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
1 3499
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andre | last post by:
Hi, I need to fetch a value in an Access db, so i use a form to pass the parameter for the SQL statement fromVB client to ASP. After the submit line in VBscript, i expect the value in order to...
5
by: Koen | last post by:
Hi all, I am experimenting with DAO. I wrote this sub to update one specific field of one specific row in one specific table. Nothing wrong with the SQL statement, but when I execute this I get...
0
by: Tony Williams | last post by:
I have a tick box control that when checked opens Outlook and attaches a report. If the user clicks send then everything is OK. BUT if the user clicks the close on Outlook without sending the email...
51
by: WindAndWaves | last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one of those NEVER USE. I can understand that it may lead to confusing code, but I often use it like this: is this...
2
by: Jack | last post by:
It appears that RecordsAffected reports the wrong value when a Null integer or date value is inserted using empty quotes. The insert works fine, but RecordsAffected reports 0 instead of 1. Here...
4
by: Hyphessobrycon | last post by:
Private Sub btnrubriekbij_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnrubriekbij.Click 'insert hier Dim cn As New OleDb.OleDbConnection(constr) Dim dc As...
11
by: pamelafluente | last post by:
Hi I am executing some simple sample code: Using OleDbCommand As New OleDbCommand(Me.DBQuery.Text, Me.OleDbConnection) Dim OleDbParameter As OleDbParameter =...
3
by: laparico2002 | last post by:
I am quite new to VB6.0. Now am trying to create a connection to NWIND.mdb. But each time i run my program i keep getting error in "Wrong argument passed" the below were what i wrote in my MODULE ...
12
by: anantraoneel | last post by:
Hi Friend My project is a Library System. In Project is Book Master form. If I've select Book Type from Type Master and Publication from Publication Master then this error has come: "Arguments...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.