Adding records automatically

G

Guest

I have two tables.

One holds personal data (tblPerson includes - personRef, personName etc) the
other holds details about where that person is on a given date
(tblAppointments Inc - visitID, personRef, Date, Location)

The tables a joined by personRef with a one-many relationship

I need to be able to enter a date (e.g. 27/6/2005) on a form and click a
button to create records, for each of the staff listed in the tblpersonresp
table, into the tblappointments table with the date filled in as 27/6/05.

I think I have seen this been achieve by the means of a query but can not
seem to find the details again.

Can anyone one help?
 
J

John Spencer (MVP)

The SQL would look something like the following

INSERT Into tblAppointments (PersonRef, [Date])
SELECT t.PersonRef, Forms!FormName!DateControl
FROM tblPerson

By the way, Date is a reserved word in Access. You would be better off using a
name such as AppointmentDate for the field in order to preclude confusion at
some future time.
 
G

Guest

Worked a treat. U r a star !!

thank you

Paul

John Spencer (MVP) said:
The SQL would look something like the following

INSERT Into tblAppointments (PersonRef, [Date])
SELECT t.PersonRef, Forms!FormName!DateControl
FROM tblPerson

By the way, Date is a reserved word in Access. You would be better off using a
name such as AppointmentDate for the field in order to preclude confusion at
some future time.
I have two tables.

One holds personal data (tblPerson includes - personRef, personName etc) the
other holds details about where that person is on a given date
(tblAppointments Inc - visitID, personRef, Date, Location)

The tables a joined by personRef with a one-many relationship

I need to be able to enter a date (e.g. 27/6/2005) on a form and click a
button to create records, for each of the staff listed in the tblpersonresp
table, into the tblappointments table with the date filled in as 27/6/05.

I think I have seen this been achieve by the means of a query but can not
seem to find the details again.

Can anyone one help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top