sql - Insert multiple rows into a single table from a textbox form - Access 2010 -


i have table single field (defined number) in insert multiple rows textbox in form. code is:

private sub cmdimportid_click()  dim strsql string    strsql = "delete * [con_id futcanc bamb]"     docmd.runsql strsql    strsql = "insert [con_id futcanc bamb] (con_id) values (" & me!conid & ");"      docmd.runsql strsql      end sub 

problem is: works single number in textbox, when try insert more 1 receive "run-time error '3075': syntax error (missing operator) in query expression". how can modify code insert more data? sorry, i'm not skilled in coding vba :(

thank in advance.

the code have written single row insert , run 1 time. if seperator present numbers in textbox, loop through each number splitting text seperator , insert seperate rows in db.

generally

insert [con_id futcanc bamb] (con_id) values (1) 

will inserts 1 row and

insert [con_id futcanc bamb] (con_id) values (1,2) invalid statement.

edit:

refer below link split , loop code logic

split , loop


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -