Re: Help with INSERT

From: Michel Walsh (vanderghast_at_VirusAreFunnierThanSpam)
Date: 01/17/05


Date: Mon, 17 Jan 2005 13:32:34 -0500

Hi,

    You make a join with a standard SELECT statement.

If tableA has three records, a, b, and c, while tableB as four records, 1,
2, 3, and 4, then

SELECT tableA.f1, tableB.g1
FROM tableA, tableB

will generate the 12 possibilities

a 1
a 2
a 3
a 4
...
c 3
c 4

You can then change the SELECT statement into an INSERT statement, in the
query designer, from its menu or form the toolbar. The goal is to get the
SELECT statement right, as you want it, and once you are happy with it,
change it for an insert (if you need it: you can build a from or a report
from a SELECT query, no obligation to necessary use a table).

Hoping it may help,
Vanderghast, Access MVP

"Scott Bridges" <ScottBridges@discussions.microsoft.com> wrote in message
news:A26AAFE0-AC94-4988-8A4B-F7A71CD55ED9@microsoft.com...
> I'm very new to Access, and trying to learn SQL at the same time.
>
> I'm working on a database in Access to track calls and correspondence.
> Thanks to help from this group I now have a query to pull all contacts
> that
> have not received a call or letter in the last 45 days. Now, lets say its
> time to send out a newsletter to all the contacts. The tables are one to
> many, Contacts to Calls.
>
> I have a small form that has fields for Date, Time, Subject and Notes. I
> put
> in a Date and a Time, the subject of the letter or call and any other
> notes.
> Since I'm sending this letter out to all of my contacts I need to insert
> one
> record in the Calls table for each of the contacts in the Contacts table.
> The
> Date, Time, Subject and Notes all need to come from the form.
>
> How can I build an INSERT statement that will create one record in Calls
> for
> each record in Contacts and fill in the other four fields Date, Time,
> Subject
> and Notes from the form?
>
> I'm sorry this post is so long. I'm just trying to be clear. I appreciate
> everyone's help and don't want this to be as confusing for you as it is
> for
> me.
>
> Thanks



Relevant Pages

  • Re: Problem with Dual subselect
    ... So I've constructed a UNION QUERY as follows. ... FROM TABLEA AS A ... B.STATUS_DATE FROM [TABLEB] As B ... A Lookup property on the foreign-key field ...
    (microsoft.public.access.queries)
  • Re: use a result as a FIELD in the design grid
    ... I have a key TableA that maps each station's flow (and ... Station: FlowField: TankLevel: PumpRun: ... OK, now from the previous query, I know that the FlowField ... So in a new query grid where TableA is linked to TableB ...
    (microsoft.public.access.queries)
  • Re: Advanced query issue
    ... and then write a query linking just by your new ... FROM tablea As a RIGHT JOIN tableb as b ... That assumes tableb has all the possible occurrence of the two ... I also used UNION ALL, ...
    (microsoft.public.access.queries)
  • Re: Finding matching records
    ... >> An inner join in a query will return only records where the join ... Suppose you have two tables, TableA and TableB, with these fields: ... A_ShouldMatch has a match in the B_ShouldMatch field in TableB. ... create a new query in Design View and add both TableA and TableB to the ...
    (microsoft.public.access.modulesdaovba)
  • Re: Advanced query issue
    ... my mistake, in the second query, should have been UNION not UNION ALL, ... If lots of a.c are empty in the first query, it is because they appear ONLY ... FROM tablea As a RIGHT JOIN tableb as b ...
    (microsoft.public.access.queries)

Loading