views:

56

answers:

1

Good day

I have a table(abc) with 2 fields (items = type TEXT) & (Check = type Yes/No)

I created a form, in a sub-form Table(abc) displays items, and a checkbox(check)

How do I code a query to save only the items checked in another table.

plz

A: 

It seems that you may want a Make Table or an Append Query:

 Dim db As Database

 Set db=CurrentDB

 ''Make table, NewTable must not exist
 strSQL="SELECT Field1, Field2, CheckedField INTO NewTable "
       & "FROM SomeTable WHERE CheckedField = True"

 db.Execute strSQL, dbFailOnError

 ''Append query
 strSQL="INSERT INTO ExistingTable (Field1, Field2, CheckedField) "
       & "SELECT Field1, Field2, CheckedField " _
       & "FROM SomeTable WHERE CheckedField = True"

 db.Execute strSQL, dbFailOnError
Remou
What purpose is there in assigning a database variable when you could use CurrentDB directly?
David-W-Fenton
As I understand it, if the db is assigned to a variable, it can be used to check records affected, which is not the case with CurrentDB.
Remou