.Execute query with form criteria

brother

Programmer
Local time
Today, 13:25
Joined
Mar 30, 2009
Messages
40
Hi!

I'm writing an append query in SQL/VBA and I want to be able to trap errors when running the query. Using .Execute is a good way to do this, the only thing is that is does not work when refrencing to a form field as a criteria.

Ex. [Forms]![frmExample].form![txtExample]

Is there a way to work around this?

A pointer in the right direction would be superb!!


Thanks!
 
You have to substitute variables in
.execute "Select columns from table where id = " & YourVariable
 
CurrentDb.execute strMyQuery, dbFailOnError doesn't work if you have the following in the strMyQuery Criteria / Parameter and the form is open?

[Forms]![frmExample].form![txtExample]

It should I think. Make sure your form is open.
 
Thanks for your responses. I'll take a closer look at your link LPurvis and see what I can make of it :D
 

Users who are viewing this thread

Back
Top Bottom