Insert range records in table depending on two values in form

L

lassang01

Hello,

I want to create a form that I can put two seperated numbers in two
text boxes and by clicking a command button a macro will be running
and will be inserting a range of numbers in field1 between text box1
and text box2 in Tbl1 .

Any help will be highly appreciated.

Regards
angar
 
K

KARL DEWEY

Create a table named CountNumber with field CountNUM containing number from 0
(zero) to your maximum spread.
INSERT INTO Tbl1 ( field1 )
SELECT [Forms]![YourForm]![box1]+[CountNUM] AS field1
FROM CountNumber
WHERE ((([Forms]![YourForm]![box1]+[CountNUM])<=[Forms]![YourForm]![box2]));
 
L

lassang01

Thanks for responding to my request.
Sorry I am still confused,regarding to myself as a MS access beginner,
is this a code or an append query?
I am pleased to list hererafter the tables and fields I have in my DB:
tbl1=Checks pertains (field1=Check Id)
form1=AddChecksRange pertains (box1=Checks from, box2=Checks to,
Command button1= AssignAboveChecksRange)

the action I want to get is: when I click on Command button1 a range
of values from box1 to box2 will be auto. inserted in field1 in tbl1

Regards
 
K

KARL DEWEY

What I posted was the SQL statement of an append query. Open a query in
design view, click VIEW - SQL View, paste the SQL statement, edit to your
table and field names, remove any hard returns the copying and post/pasting
may have inserted.
 

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