Removing questions from append query

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

I have a append query that runs when i click a button on the form.

When i click it i get the fllowing messages

'You are about to run a append query that will modity data in your
table, Are you sure you want to run this type of query? YES NO"

The i clcik YES then get the next message
' You are about to append 1 Rows YES NO'



Is there a way to stop all these questions coming up.
I would prefer it that i just press the button on the form and it runs
the query and does not bring any thing up on the screen


Can this been done

Thanks
 
Hi Simon

Two ways:

DoCmd.SetWarnings False
DoCmd.OpenQuery "Query Name"
DoCmd.SetWarnings True

or, IMO better:

Dim qdf as DAO.QueryDef
Set qdf = CurrentDb.QueryDefs("Query Name")
qdf.Execute dbFailOnError
MsgBox qdf.RecordsAffected & " records have been updated"
Set qdf = Nothing
 
i have just tired it but got an error with

qdf.Execute dbFailOnError


could you tell me whats wrong

Thanks for your help
Graham said:
Hi Simon

Two ways:

DoCmd.SetWarnings False
DoCmd.OpenQuery "Query Name"
DoCmd.SetWarnings True

or, IMO better:

Dim qdf as DAO.QueryDef
Set qdf = CurrentDb.QueryDefs("Query Name")
qdf.Execute dbFailOnError
MsgBox qdf.RecordsAffected & " records have been updated"
Set qdf = Nothing

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Simon said:
I have a append query that runs when i click a button on the form.

When i click it i get the fllowing messages

'You are about to run a append query that will modity data in your
table, Are you sure you want to run this type of query? YES NO"

The i clcik YES then get the next message
' You are about to append 1 Rows YES NO'



Is there a way to stop all these questions coming up.
I would prefer it that i just press the button on the form and it runs
the query and does not bring any thing up on the screen


Can this been done

Thanks
 
What was the error?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Simon said:
i have just tired it but got an error with

qdf.Execute dbFailOnError


could you tell me whats wrong

Thanks for your help
Graham said:
Hi Simon

Two ways:

DoCmd.SetWarnings False
DoCmd.OpenQuery "Query Name"
DoCmd.SetWarnings True

or, IMO better:

Dim qdf as DAO.QueryDef
Set qdf = CurrentDb.QueryDefs("Query Name")
qdf.Execute dbFailOnError
MsgBox qdf.RecordsAffected & " records have been updated"
Set qdf = Nothing

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Simon said:
I have a append query that runs when i click a button on the form.

When i click it i get the fllowing messages

'You are about to run a append query that will modity data in your
table, Are you sure you want to run this type of query? YES NO"

The i clcik YES then get the next message
' You are about to append 1 Rows YES NO'



Is there a way to stop all these questions coming up.
I would prefer it that i just press the button on the form and it runs
the query and does not bring any thing up on the screen


Can this been done

Thanks
 
Back
Top