simple insert statement not working...HELP!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to Access so need a little help....The insert statement below has got to work but it isn't. When I run it, the 'select' result pops up in a result window but the records are not appending in t_FamilyMailing. Please, can someone tell me why?

INSERT INTO t_FamilyMailing ( FamilyID, MailingID )
SELECT a.FamilyID, 2 AS Expr1
FROM t_Family AS a
WHERE a.Flag=-1;

In case you're wondering what the table layout looks like...
1) t_Family
FamilyID (pk)
Name
Flag

2) t_FamilyMailing
FamilyID (pk)
MailingID (pk)
 
Warren,

This should work.

INSERT INTO t_FamilyMailing ( FamilyID, MailingID )
SELECT a.FamilyID, 2 AS MailingID
FROM t_Family AS a
WHERE a.Flag=-1;

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


WarrenR said:
I am new to Access so need a little help....The insert statement below has
got to work but it isn't. When I run it, the 'select' result pops up in a
result window but the records are not appending in t_FamilyMailing. Please,
can someone tell me why?
 
I am new to Access so need a little help....The insert statement below has got to work but it isn't. When I run it, the 'select' result pops up in a result window but the records are not appending in t_FamilyMailing.

I suspect you're "running" it by clicking the datasheet icon in the
toolbar - this does not actually run the query, it just previews what
you will get when you *do* run it.

To actually run the query use the ! icon in the middle of the toolbar,
or doubleclick the query name in the query window (and accept the
prompt warning that "this query will append..")
 
Back
Top