santanudas
Technical User
Hi all,
I got a little problems with 'INSERT'. I have a small ‘INSERT’ code to input data in a table (tblBooking):
Private Sub cmdSubmit_Click()
Dim strSQL As String
strSQL = "INSERT INTO tblBooking (dept, day, month, year, timing, room) VALUES ('" & Me.txtDept & "', " & Me.cmbDay & "," & _
"" & Me.cmbMonth & ", " & Me.cmbYear & ", " & Me.cmbTiming & ", " & Me.cmbRoom & "
'Print out the value of the strSQL to the immediate window for review to verify it is accurate
MsgBox strSQL
Debug.Print strSQL 'Run the SQL
DoCmd.RunSQL strSQL
Me.txtDept = ""
Me.txtDept.SetFocus
End Sub
This also working fine but when I’m inserting record first time in a totally blank table, it’s inserting the first (only) record set twice. After that as usual. Any idea?
Another question: I have a 'autonumber' field in this table. After deleting all the rows again when I start inserting data, the id (autonumber) fiels is not being started from 0; it's starting from the next number up to which I deleted. like, if I delete all 3 rows to make the table empty then next 'insert' being started from id=4 not from id=0 like a brand new table. Any idea about how to fix that?
Thanks in advance.
Santanu