Cant get sql query to work

  • Thread starter Thread starter Randy
  • Start date Start date
R

Randy

I'm trying to get this append query to work. I got it from an earlier
posting. I need to get the total number from [StartNum] to [EndNum] (1000
to 2000) and insert into [IncomingCertificateNumbers] any
ideas...Thanks..Randy

INSERT INTO [CertificateNumbers] (IncomingCertificateNumbers)
SELECT [Forms]![frmIncomingCertificates]![StartNum]
WHERE [Forms]![frmIncomingCertificates]![StartNum] <=
[Forms]![frmIncomingCertificates]![EndNum];
 
I'm trying to get this append query to work. I got it from an earlier
posting. I need to get the total number from [StartNum] to [EndNum] (1000
to 2000) and insert into [IncomingCertificateNumbers] any
ideas...Thanks..Randy

INSERT INTO [CertificateNumbers] (IncomingCertificateNumbers)
SELECT [Forms]![frmIncomingCertificates]![StartNum]
WHERE [Forms]![frmIncomingCertificates]![StartNum] <=
[Forms]![frmIncomingCertificates]![EndNum];

To do this you will need *another table*; let's call it Num, with a
single Long Integer field N. Fill this table with values from 0
through the most numbers you'll ever want to insert in one go (be
generous, a 100,000 row table is still pretty small). Change your SQL
to

INSERT INTO [CertificateNumbers] (IncomingCertificateNumbers)
SELECT N + [Forms]![frmIncomingCertificates]![StartNum]
FROM Num
WHERE N + [Forms]![frmIncomingCertificates]![StartNum] <= N +
[Forms]![frmIncomingCertificates]![EndNum];

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Thanks John, I'll give this a try..
John Vinson said:
I'm trying to get this append query to work. I got it from an earlier
posting. I need to get the total number from [StartNum] to [EndNum] (1000
to 2000) and insert into [IncomingCertificateNumbers] any
ideas...Thanks..Randy

INSERT INTO [CertificateNumbers] (IncomingCertificateNumbers)
SELECT [Forms]![frmIncomingCertificates]![StartNum]
WHERE [Forms]![frmIncomingCertificates]![StartNum] <=
[Forms]![frmIncomingCertificates]![EndNum];

To do this you will need *another table*; let's call it Num, with a
single Long Integer field N. Fill this table with values from 0
through the most numbers you'll ever want to insert in one go (be
generous, a 100,000 row table is still pretty small). Change your SQL
to

INSERT INTO [CertificateNumbers] (IncomingCertificateNumbers)
SELECT N + [Forms]![frmIncomingCertificates]![StartNum]
FROM Num
WHERE N + [Forms]![frmIncomingCertificates]![StartNum] <= N +
[Forms]![frmIncomingCertificates]![EndNum];

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top