Syntax for update all records...

  • Thread starter Thread starter Rick's News
  • Start date Start date
R

Rick's News

I want to create a button that on click it writes to the tblappointments.
I want it to create a new record for every [SSN] that is in the tblTBase.

How do I do this?

Thanks in advance!!!

-Rick
 
I want to create a button that on click it writes to the tblappointments.
I want it to create a new record for every [SSN] that is in the tblTBase.

How do I do this?

To create a new record use an Append query based on tblTBase.

Creating a new record for EVERY SINGLE ROW in a table sounds quite
unusual - wouldn't this involve a lot of redundant data? Or are you
creating a new appointment for everyone, whoever they are?
 
Yes I have a table for appointments and my students will be scheduled many
times for the same appointment.
What is the syntax to do this?

Well, the exact syntax depends on the structure of your tables, which
I don't know. Basically you would create an Append query based on the
table that you want to copy records to, selecting the fields that you
want to copy (or entering constants such as an appointment date), and
choosing the target table to which you wish to append the records. The
query can be executed using a variety of methods - the most effective
is probably the Querydef Execute method in VBA.

I'm still perplexed at the thought of EVERY SINGLE STUDENT being
scheduled for (apparently) EVERY SINGLE APPOINTMENT. Am I
misunderstanding your structure? Or is this appointments table really
necessary (since you could get a recordset with every student paired
with every appointment using a Cartesian join query)?
 
Yes I have a table for appointments and my students will be scheduled many
times for the same appointment.
What is the syntax to do this?

John Vinson said:
I want to create a button that on click it writes to the tblappointments.
I want it to create a new record for every [SSN] that is in the tblTBase.

How do I do this?

To create a new record use an Append query based on tblTBase.

Creating a new record for EVERY SINGLE ROW in a table sounds quite
unusual - wouldn't this involve a lot of redundant data? Or are you
creating a new appointment for everyone, whoever they are?
 
Not every appointment but often enough to have a button to be able to do
it...

Using a DOA recordset, how do I specify all records? If there is a record
in the tblTBASE then I want to schedule an appointment in the
tblAppointments the key for both tables is SSN.

Thanks for your help...

-Rick
 
Using a DOA recordset, how do I specify all records?

By just not applying any criteria, just naming the table:

Dim rs AS DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("tblTBASE", dbOpenDynaset)
If there is a record
in the tblTBASE then I want to schedule an appointment in the
tblAppointments the key for both tables is SSN.

You DON'T really need a recordset though. Just create an Append query
in the query design window, based on tblTBASE. Change this query to an
Append query using the query type icon. Select the fields that you
want to append; in your button code, just execute the query.
 
Back
Top