MS Access - Question
#1
Scooby Regular
Thread Starter
Join Date: Oct 2002
Location: ex UK [SE], now Sunshine State [QLD,AUS]
Posts: 565
Likes: 0
Received 1 Like
on
1 Post
MS Access - Question
Hi There,
I have a *make table* query (that works well) but I wish to enhance this by having a pop up message (once executed) that warns the user that something must have been done before the query is run.
Is this quite easy, and how do I do this ?
Thx.
I have a *make table* query (that works well) but I wish to enhance this by having a pop up message (once executed) that warns the user that something must have been done before the query is run.
Is this quite easy, and how do I do this ?
Thx.
#4
I take it you would want to check certain criteria before executing the query, then if it passes run the query, if it fails the test then prompt the user to tell them what needs doing then quit?
Little more info needed.
Little more info needed.
#5
Put it on a button, put some code behind it,
then use msgbox to put up a dialog, you can alter the parameters to display warnings and different buttons, you can then deal with the outcome in code.
docmd.runsql to run the query, you can run the query direct or paste the SQL in, this runs a maketable query in a quick and dirty I was doing
[Status].[Caption] = "Extracting Injurynat"
DoEvents
Set qry = db.QueryDefs("Extract Injurynat")
qry.Execute
[Status].[Caption] = "Injurynat Extracted"
DoEvents
so, google for msgbox and use a version of the code above, that should do the trick.
then use msgbox to put up a dialog, you can alter the parameters to display warnings and different buttons, you can then deal with the outcome in code.
docmd.runsql to run the query, you can run the query direct or paste the SQL in, this runs a maketable query in a quick and dirty I was doing
[Status].[Caption] = "Extracting Injurynat"
DoEvents
Set qry = db.QueryDefs("Extract Injurynat")
qry.Execute
[Status].[Caption] = "Injurynat Extracted"
DoEvents
so, google for msgbox and use a version of the code above, that should do the trick.
#6
Scooby Regular
Thread Starter
Join Date: Oct 2002
Location: ex UK [SE], now Sunshine State [QLD,AUS]
Posts: 565
Likes: 0
Received 1 Like
on
1 Post
Version of Access is 2003 SP2
(i'm at home now, so i can't check this).
"Do you mean when the user selects to run the query it pops up the message prior to executing?"
Yes - the pop up message should be the first thing that happens.
A "continue? Y/N" message would be ideal.
Yes - the query runs (and makes a table)
No - the query stops.
I've thought about using a button on forms and/or a macro, but users (ie my boss) my run the macro direct from the *query* screen. Hence the need for the message.
Thx.
(i'm at home now, so i can't check this).
"Do you mean when the user selects to run the query it pops up the message prior to executing?"
Yes - the pop up message should be the first thing that happens.
A "continue? Y/N" message would be ideal.
Yes - the query runs (and makes a table)
No - the query stops.
I've thought about using a button on forms and/or a macro, but users (ie my boss) my run the macro direct from the *query* screen. Hence the need for the message.
Thx.
#7
Something like this
Create a button on a form, and paste the code in to the on click expression
Code:
Dim strMsg As String, strTitle As String Dim intStyle As Integer Dim stDocName As String strMsg = "Have you done such and such before continuing?" intStyle = vbOKCancel strTitle = "Query Maketable" Response = MsgBox(strMsg, intStyle, strTitle) If Response = vbOK Then ' User chose Ok. stDocName = "Query Name To Run" ' Name of Your Query DoCmd.OpenQuery stDocName, acNormal, acEdit Else ' User chose Cancel. Exit Sub End If
Trending Topics
#8
You can disable access to the tables/queries etc and run everything thru a front end menu to limit what users are doing.
#10
Tools / Database Utilities / Switchboard manager
this sets up your menu, just add your form and any other forms / reports you want users to be able to run.
Then
Tools / Startup
Make sure the Display/Page Form says switchboard, and then deselect the Display Database Window.
If you wish to get access to the database window yourself for editing, you can bring it up by pressing F11.
this sets up your menu, just add your form and any other forms / reports you want users to be able to run.
Then
Tools / Startup
Make sure the Display/Page Form says switchboard, and then deselect the Display Database Window.
If you wish to get access to the database window yourself for editing, you can bring it up by pressing F11.
#11
Scooby Regular
Thread Starter
Join Date: Oct 2002
Location: ex UK [SE], now Sunshine State [QLD,AUS]
Posts: 565
Likes: 0
Received 1 Like
on
1 Post
Thanks, I'll try the Form trick.
But just to conclude, I therefore assume that it is not possible to have a pop up message directly within the query.
I assume that it has to be part of a procedure, in which running the query is the second part.
Is this correct ?
I notice you can view the SQL code of the query, but assume that you cant include a bit of VB code in there ? It would be nice if you could !!
But just to conclude, I therefore assume that it is not possible to have a pop up message directly within the query.
I assume that it has to be part of a procedure, in which running the query is the second part.
Is this correct ?
I notice you can view the SQL code of the query, but assume that you cant include a bit of VB code in there ? It would be nice if you could !!
#12
I dont think you can add to the query before it executes, but i only know enough vba/access to get by
you could try posting or browsing on here
MrExcel Message Board :: Index
you could try posting or browsing on here
MrExcel Message Board :: Index
Thread
Thread Starter
Forum
Replies
Last Post
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM