You are about to append o rows

Mojo1

Board Regular
Joined
Mar 6, 2003
Messages
148
How do I get this from coming up when I want to append and delete a record?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
One way to do it would be to create a Macro to run the query(ies). The first line of the macro would be SetWarnings (false) and the last line would be SetWarnings (true). This would eliminate the confirmation messages.

Not sure if this is what you wanted....
 
Upvote 0
Code to run the append/delete queries

Here is what I have right now:

Private Sub cmdArchive1_Click()

'DoCmd.SetWarnings False
DoCmd.OpenQuery "AddRecord1"
DoCmd.OpenQuery "ArchiveRecord"
'DoCmd.SetWarnings True



End Sub
 
Upvote 0
How can I make it work?

I do not want to eliminate confirmation messages, but want to know how I can get the queries to append and delete the record.
 
Upvote 0
I got it figured out somewhat

It seems if you type in all the fields, you will be able to append.
 
Upvote 0
Hmm...I'm sorry but I'm not exactly clear on the question. Your SetWarnings statements (which are commented out) would control whether or not you see the warnings. Alternatively you could use something like...

Code:
Dim dbs As Database
Dim strSQL as String

Set dbs = CurrentDb
strSQL = "[Enter the SQL from your query here]"

dbs.Execute strSQL

This wouldn't display any messages and would also allow you to use the RecordsAffected property to test how many rows were impacted by the query. Still don't know if this helps, but if not perhaps you could elaborate on the question a bit more.
 
Upvote 0
I just want the delete query to work

I have the append query working, but want my delete query to work as well.
 
Upvote 0
Howdy, code for thought, sound like you don't need the first...

Code:
Sub appnd()
Dim db As DAO.Database, rs As DAO.Recordset
Set db = DBEngine(0)(0)
Set rs = db.OpenRecordset("TblTrackInfo", dbOpenTable)
With rs
    .AddNew
    .Fields(0) = "Test1"
    .Fields(1) = "Test2"
    .Fields(2) = "Test3"
    .Update
    .Close
End With
Set db = Nothing: Set rs = Nothing
End Sub

Sub Remy()
Dim db As DAO.Database, rs As DAO.Recordset
Set db = DBEngine(0)(0)
Set rs = db.OpenRecordset("TblTrackInfo", dbOpenTable)
With rs
    .MoveLast
    .Delete
    .Close
End With
Set db = Nothing: Set rs = Nothing
End Sub

I get no warnings with this. Oh, this is not a query, rather, a vba procedure. Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,221,525
Messages
6,160,327
Members
451,637
Latest member
hvp2262

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top