-2
Private Sub cmdenter_Click()
     If Option1.Value = True Then
        db.Execute "Insert into TM_REGISTRATION values('" + txtregdn.Text + "','" + txtformno.Text + "','" + Combo1.Text + "','" + Format(mskadmdt.Text, "mm-dd-yyyy") + "','" + studentname.Text + "','" + Combo2.Text + "','" + fname.Text + "','" + fmobile.Text + "','" + mname.Text + "','" + mmobile.Text + "','" + gname.Text + "','" + gmobile.Text + "','" + Format(mskdob.Text, "mm-dd-yyyy") + "',1,0,'" + Combo3.Text + "','" + Combo4.Text + "','" + Combo5.Text + "','" + Combo6.Text + "','" + txtaddress1.Text + "','" + txtaddress2.Text + "','" + district.Text + "','" + pincode.Text + "','" + Picture1.Picture + "')"
     ElseIf Option2.Value = True Then
        db.Execute "Insert into TM_REGISTRATION values('" + txtregdn.Text + "','" + txtformno.Text + "','" + Combo1.Text + "','" + Format(mskadmdt.Text, "mm-dd-yyyy") + "','" + studentname.Text + "','" + Combo2.Text + "','" + fname.Text + "','" + fmobile.Text + "','" + mname.Text + "','" + mmobile.Text + "','" + gname.Text + "','" + gmobile.Text + "','" + Format(mskdob.Text, "mm-dd-yyyy") + "',0,1,'" + Combo3.Text + "','" + Combo4.Text + "','" + Combo5.Text + "','" + Combo6.Text + "','" + txtaddress1.Text + "','" + txtaddress2.Text + "','" + district.Text + "','" + pincode.Text + "','" + Picture1.Picture + "')"
     End If
End Sub
Yaseen Ahmad
  • 1,807
  • 5
  • 25
  • 43

2 Answers2

0

Columns are missing.

SQL INSERT INTO SELECT Statement

https://www.w3schools.com/sql/sql_insert_into_select.asp

Giorgio Brausi
  • 414
  • 3
  • 7
0

Format the date value expressions correctly:

db.Execute "Insert into TM_REGISTRATION values('" + txtregdn.Text + "','" + txtformno.Text + "','" + Combo1.Text + "',#" + Format(mskadmdt.Text, "yyyy\/mm\/dd") + "#,'" + studentname.Text + "','" + Combo2.Text + "','" + fname.Text + "','" + fmobile.Text + "','" + mname.Text + "','" + mmobile.Text + "','" + gname.Text + "','" + gmobile.Text + "',#" + Format(mskdob.Text, "yyyy\/mm\/dd") + "#,1,0,'" + Combo3.Text + "','" + Combo4.Text + "','" + Combo5.Text + "','" + Combo6.Text + "','" + txtaddress1.Text + "','" + txtaddress2.Text + "','" + district.Text + "','" + pincode.Text + "','" + Picture1.Picture + "')"
Gustav
  • 53,498
  • 7
  • 29
  • 55