Series numbers to Table

Gismo

Registered User.
Local time
Tomorrow, 00:27
Joined
Jun 12, 2017
Messages
1,298
Hi All,

a user copies information from PDF to a form
the information in the control could be a series of serial numbers separated by n comma

I want to take the series number and populate it in a new table, each serial number to a new record

Sample: 4354, 6456, 6543, 7634, 7345, 7643,6533

to: 4354
6456
6543
7634
7345
7643
6533

how would I accomplish this?
The string could have anything from 1 to 50 serial numbers
 
Last edited:
use split() function:

dim strTest as string
dim var as variant
dim v as variant

strTest = "4354, 6456, 6543, 7634, 7345, 7643,6533"

var = split(strTest, ",")
for each v in var
if len(trim(v & ""))>0 then
currentdb.execute "insert into tablename (fieldname) select " & v
end if
next
 
use split() function:

dim strTest as string
dim var as variant
dim v as variant

strTest = "4354, 6456, 6543, 7634, 7345, 7643,6533"

var = split(strTest, ",")
for each v in var
if len(trim(v & ""))>0 then
currentdb.execute "insert into tablename (fieldname) select " & v
end if
next
the strtest is only a sample, how do i code this to any sequence of number entered by the user?
 
Last edited:
the strtest is only a sample, how do i code this to any sequence of number entered by the user?
Have you even tested it to see how it works :(
 
yes, i have
getting errors on
# currentdb.execute "insert into tablename (fieldname) select " & v #
Ahh, you are meant to replace fieldname and tablename with your field and table names? :rolleyes::rolleyes:
I would have probably used Values instead of Select

Google the syntax for the INSERT SQL statement.
 
Ahh, you are meant to replace fieldname and tablename with your field and table names? :rolleyes::rolleyes:
I would have probably used Values instead of Select

Google the syntax for the INSERT SQL statement.
i did replace with my table and field name
seems to be fine

only thing is, the range of sequence numbers are never the same so i can not have it fixed in the code
how do I code to select from the form where entered?

strTest = "4354, 6456, 6543, 7634, 7345, 7643,6533" serial numbers must be selected from the form
 
Last edited:
I'll leave arnelgp to explain, but you should really start making some effort in understanding the code that is given to you, :( given the time you have been here and the number of posts you have made?
 
got it, thank you for the support, always much appreciated
 

Users who are viewing this thread

Back
Top Bottom