Updating tables with unbound form

  • Thread starter Thread starter DNF Karran
  • Start date Start date
D

DNF Karran

I have a form that takes input from a user, validates it then updates
tables and writes new data to another. I get the impression i will nee
2 update and 1 insert commands in SQL however my access help file ha
died and my only access book only covers selecting and joining.

The data validation is run through VBA when the user clicks a butto
and I have all of the data I need to post to the following table
ready:

1) Update table 1, col3 & col4
2) Update table 2, col3 & col4
3) Add new record to table 3, col1, col2, col3

Basically i need the syntax required in either sql or vba to do this.

Thank
 
Hi,


The query wizard would have produced the code for the first two:

CurrentDb.Execute " UPDATE table1 SET col3= ... , col4= ... WHERE
ConditionIdentifyingWhichRecord(s)ToUpdate ", dbFailOnError



and the third one is a special case of an INSERT INTO:


CurrentDb.Execute " INSERT INTO table3(col1, col2, col3) VALUES( val1,
val2, val3 ); ", dbFailOnError




Hoping it may help,
Vanderghast, Access MVP
 
Back
Top