OnClick, If..then add to other table

  • Thread starter Thread starter KAquestions
  • Start date Start date
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
 
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
 
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
 
Back
Top