By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,036 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,036 IT Pros & Developers. It's quick & easy.

adding a series of records

P: n/a
Help, to early in the morning to think.

My goal is to take info from a form, and create multiple entries in a
temp table.

Basically the form has the fields <first_number>, <last_number>,
<name>, <year>

Just need it to create an entry for each number between the first and
last number to create labels, then I run an SQL statement to clear the
table.

I will post my "do until" code when I get to work, but if someone can
air code an example I would be more than grateful.

Steven

Sep 28 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
There is an article on my site that may help you generating a range of
numbers. See Articles -Range.

st***********@merck.de schreef:
Just need it to create an entry for each number between the first and
last number to create labels, then I run an SQL statement to clear the
table.

I will post my "do until" code when I get to work, but if someone can
air code an example I would be more than grateful.

Steven
--
Bas Cost Budde
Holland
www.heuveltop.nl/BasCB/msac_index.html
Sep 28 '06 #2

P: n/a

st***********@merck.de wrote:
Help, to early in the morning to think.

My goal is to take info from a form, and create multiple entries in a
temp table.

Basically the form has the fields <first_number>, <last_number>,
<name>, <year>

Just need it to create an entry for each number between the first and
last number to create labels, then I run an SQL statement to clear the
table.

I will post my "do until" code when I get to work, but if someone can
air code an example I would be more than grateful.

Steven
Some variation of this would work. Put it in the Click event of a
button.

dim intThisNo as integer
dim rs as DAO.Recordset

set rs=dbengine(0)(0).OpenRecordset("SourceTable",dbOp enTable,
dbAppendOnly)

For intThisNo = me.First_Number To Me.Last_Number
rs.AddNew
rs.Edit
rs.Fields("NumberField) = intThisNo
rs.fields("Name") = me.txtName '---point it at the text
field "txtName" on the form.
rs.fields("Year") = CInt(me.txtYear)
rs.Update
Next intThisNo

rs.close

set rs=nothing

Sep 28 '06 #3

P: n/a
That worked perfect. Used pretty much all of the code, since it was
much neater than mine.

Thanks for the help.

Sep 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.