vba - Insert data from a form into a table -


this question exact duplicate of:

it's been 3 years since have had use vb or vba code. working on project work using microsoft access need take information listed on form , insert table. stuck on last part of code values part. have far.

insert volunteers (name, email, number, emergency contact, emergency number) values (and stuck) 

thank in advance!

you want single-record table append query:

insert volunteers (name, email, number, emergency contact, emergency number)  values ("value1", "value2", "value3", "value4", "value5") 

assuming constructing sql statement in code-behind of form, can access controls name:

dim sql string sql = _     "insert volunteers (name, email, number, emergency contact, emergency number)  " & _     "values (""" & txbname & """, """ & txbemail & """, """ & txbnumber & """, """ & txbemergencycontact & """, """ & txbemergencynumber & ")" 

(all triple-quotes double-quote (") final sql statement, text fields; numeric fields don't need delimiter, , date fields use # delimiter.)
if adding values different form, can access them so:

forms!otherform!controlname 

and values in subform (iirc):

subformcontrol.form!controlname 

see here more details.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -