append and update without confirmation message

  • Thread starter Thread starter Haggr1 via AccessMonster.com
  • Start date Start date
H

Haggr1 via AccessMonster.com

I have a append query

INSERT INTO style ( Job, [Order], Qty, c, Item, [Size], Avl, Type, Due, Age,
[Req'd], [Curr Routing], Sts, Days, Field17, Field18, Field19,
,
Field21, Field22, Field23, Ordered, Field25, Style )
SELECT Import.Job, Import.Order, Import.Qty, Import.C, Import.Item, Import.
Size, Import.Avl, Import.Type, Import.Due, Import.Age, Import.[Req'd], Import.
[Curr Routing], Import.Sts, Import.Days, Import.Field17, Import.Field18,
Import.Field19, Import.Left, Import.Field21, Import.Field22, Import.Field23,
Import.Ordered, Import.Field25, Import.Style
FROM Import
WHERE (((Import.Job) Is Not Null) AND ((Import.Type)<>"laser" And (Import.
Type)<>"engrave" And (Import.Type)<>"mill"));


and an update query

UPDATE Style SET Style.MatchString = fGetFirstChars_Nums_w([item]);

Currently I run these independently, first the append then the update and go
thought all the confirmaton messages.

Is it possible to have one command to run both and without any confirmation
messages​
 
There are two ways to supress the warning and confirmation messages.
One is to set the warnings off and on as desired:

DoCmd.SetWarnings False 'Turn Off Warnings
'Do some stuff
DoCmd.SetWarnings True 'Turn On Warnings

My preference is to use the Execute method. It doesn't trigger the warnings
because it does not go through the Access UI, it goes directly to Jet. This
also makes it significantly faster. You just need to be sure to use the
dbFailOnError option so that any errors thrown by Jet will be passed back to
Access so you will know an error occurred.

With DoCmd
.Execute("An Action Query Here"), dbFailOnError
.Execute("Another Action Query"), dbFailOnError
End With

You can use the name of a stored query, or a string that is a valid SQL
statemt.
 
Where would I put the method? The "on click" event of a command button?


There are two ways to supress the warning and confirmation messages.
One is to set the warnings off and on as desired:

DoCmd.SetWarnings False 'Turn Off Warnings
'Do some stuff
DoCmd.SetWarnings True 'Turn On Warnings

My preference is to use the Execute method. It doesn't trigger the warnings
because it does not go through the Access UI, it goes directly to Jet. This
also makes it significantly faster. You just need to be sure to use the
dbFailOnError option so that any errors thrown by Jet will be passed back to
Access so you will know an error occurred.

With DoCmd
.Execute("An Action Query Here"), dbFailOnError
.Execute("Another Action Query"), dbFailOnError
End With

You can use the name of a stored query, or a string that is a valid SQL
statemt.
I have a append query
[quoted text clipped - 20 lines]
Is it possible to have one command to run both and without any confirmation
messages
 
That would work just fine.
--
Dave Hargis, Microsoft Access MVP


Haggr1 via AccessMonster.com said:
Where would I put the method? The "on click" event of a command button?


There are two ways to supress the warning and confirmation messages.
One is to set the warnings off and on as desired:

DoCmd.SetWarnings False 'Turn Off Warnings
'Do some stuff
DoCmd.SetWarnings True 'Turn On Warnings

My preference is to use the Execute method. It doesn't trigger the warnings
because it does not go through the Access UI, it goes directly to Jet. This
also makes it significantly faster. You just need to be sure to use the
dbFailOnError option so that any errors thrown by Jet will be passed back to
Access so you will know an error occurred.

With DoCmd
.Execute("An Action Query Here"), dbFailOnError
.Execute("Another Action Query"), dbFailOnError
End With

You can use the name of a stored query, or a string that is a valid SQL
statemt.
I have a append query
[quoted text clipped - 20 lines]
Is it possible to have one command to run both and without any confirmation
messages
 
Here's what I did


Private Sub Command49_Click()
On Error GoTo Err_Command49_Click

With DoCmd
.Execute "qrystyleappendstyle", dbFailOnError
.Execute "qrystylegary", dbFailOnError
End With

Exit_Command49_Click:
Exit Sub

Err_Command49_Click:
MsgBox Err.Description
Resume Exit_Command49_Click

End Sub


When I try to run I get and error message
"Complie Error" "Method or data member not found"
With "Execute" highlighted
That would work just fine.
Where would I put the method? The "on click" event of a command button?
[quoted text clipped - 24 lines]
 
I am so sorry. I don't know what I was thinking. It should be
With CurrentDb
--
Dave Hargis, Microsoft Access MVP


Haggr1 via AccessMonster.com said:
Here's what I did


Private Sub Command49_Click()
On Error GoTo Err_Command49_Click

With DoCmd
.Execute "qrystyleappendstyle", dbFailOnError
.Execute "qrystylegary", dbFailOnError
End With

Exit_Command49_Click:
Exit Sub

Err_Command49_Click:
MsgBox Err.Description
Resume Exit_Command49_Click

End Sub


When I try to run I get and error message
"Complie Error" "Method or data member not found"
With "Execute" highlighted
That would work just fine.
Where would I put the method? The "on click" event of a command button?
[quoted text clipped - 24 lines]
Is it possible to have one command to run both and without any confirmation
messages
 
That was it,

Now I would like to show a "progress bar" other than the one at the bottom
of the form. Thanks
I am so sorry. I don't know what I was thinking. It should be
With CurrentDb
Here's what I did
[quoted text clipped - 25 lines]
 
Back
Top