hi guys...!
when i tried to insert the form's information into the database either the check box in the form is checked or not once this check box in the table appear as checked and second time unchecked...
i don't know why that is happening...?
please help out...
thank you
best regards
4ukh
Private Sub Chop_it_Click()
Dim Vtemp As Integer
Dim x As Integer
Vtemp = 0
x = 0
'Here first we check whether or not if any record exists in the table
If CurrentDb.OpenRecordset("SELECT COUNT(CRID_index.CRID_num) FROM CRID_index")(0) > 0 Then
Vtemp = CurrentDb.OpenRecordset("SELECT MAX(CRID_index.CRID_num) FROM CRID_index WHERE CRID_index.CRID = '" & cg_txtCRID & "' ")(0)
Else
Vtemp = 0
End If
MsgBox Vtemp
'check the check box state and assign the value
If cg_p_chk.Value = vbChecked Then
cg_p_chk = 1
Else
cg_p_chk = 0
End If
Do While x < cg_chp_num
x = x + 1
Vtemp = Vtemp + 1
'fals for all worning while inseting the records
DoCmd.SetWarnings fals
'basic SQL statement for the table CRID_index
DoCmd.RunSQL "INSERT INTO CRID_index ([CRID], [CRID_num], [server_ip], [server_port], [payment], [payment_rece_chk], [validation_period], [start_date], [exp_date])" & _
"VALUES ('" & cg_txtCRID & "', '" & Vtemp & "' , '" & cg_txtservIP & "', '" & cg_serv_port & "', '" & cg_unit_price & "', '" & cg_p_chk & "', '" & cg_validation & "', '" & cg_start & "', '" & cg_exp & "');"
Loop
MsgBox "All valuable records are successfully inserted into the database."
End Sub