View Full Version : append query help


bandr0
06-06-2007, 05:54 AM
Hi,

Im using an append query to update one table depending on what gets entered into another one(contable -> companytable). Im running this as part of the click to add details from a form to contable, it takes whatever is entered into the company column on contable and adds it to the company column on the other table.

Ive set the second table not to allow duplicates because thats how i need it but this means that whenever it runs the append query it comes up with an error saying that it couldnt copy X amount of entries(as they would be duplicates). It does only copy the new one but how can i set it to only try and copy the new entry instead of all of them so i no longer get this error message. is it possible to intergrate an unmatched query into the append query?

hope thats not too confusing reading! any ideas?

Thanks
James

Fifty2One
06-06-2007, 09:18 AM
Put this before your SQL
DoCmd.SetWarnings False
and this after
DoCmd.SetWarnings True
you would want to turn warnings back on after so you dont have things mess up somewhere else and you have no error flag...

boblarson
06-06-2007, 09:20 AM
I keep hoping anyone suggesting using DoCmd.SetWarnings False will ALSO include this information:

And ALWAYS put an error handler in whatever event you use the SetWarnings code and in the first line of your error handler put:

DoCmd.SetWarnings True

so that if it errors out before it gets to that line in your normal code it will get reset. If you don't, you could wind up without any error messages at all for anything.

bandr0
06-07-2007, 02:27 AM
awesome!! thanks guys, works a treat. such a simple solution! wish id thought of that haha