OnClick, If..then add to other table

K

KAquestions

Hi all,

I have been working on various code combinations for this, but not getting
anywhere. So was hoping someone could help.

I have a form with 1 bound text box "SID" (PK and FKthroughout DB) and 4
unbound check boxes, and a button called "Confirm"

What i want is when the user clicks "Confirm", if "CheckBox1" is ticked, add
a record to a table "tbl2" with "SID" from for form going to "SID" in the
table, and "Int" in the table becoming "1".

Or else, if the user ticks "Checkbox2", "SID" goes into table, with "Int"
becoming "2"

The table design is just 2 fields

SID
Int

Am i making sense?

Can anyone help?

K
 
A

April

Try using an SQL statement and the DoCmd.RunSQL to insert a new record into
your table..

Dim sSQL As String

sSQL = "INSERT INTO yourTableName ([Int],[SID])" & _
"VALUES (1," & ValueFromForm & ");"

DoCmd.RunSQL sSQL
 
K

KAquestions

April,

Many thanks for this. Will have a go and let you know how i get on!

K

April said:
Try using an SQL statement and the DoCmd.RunSQL to insert a new record
into
your table..

Dim sSQL As String

sSQL = "INSERT INTO yourTableName ([Int],[SID])" & _
"VALUES (1," & ValueFromForm & ");"

DoCmd.RunSQL sSQL




KAquestions said:
Hi all,

I have been working on various code combinations for this, but not
getting
anywhere. So was hoping someone could help.

I have a form with 1 bound text box "SID" (PK and FKthroughout DB) and 4
unbound check boxes, and a button called "Confirm"

What i want is when the user clicks "Confirm", if "CheckBox1" is ticked,
add
a record to a table "tbl2" with "SID" from for form going to "SID" in the
table, and "Int" in the table becoming "1".

Or else, if the user ticks "Checkbox2", "SID" goes into table, with "Int"
becoming "2"

The table design is just 2 fields

SID
Int

Am i making sense?

Can anyone help?

K
 

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