Here is a little example to add a record using visual basic and MySQL.
'-------------------------------------------------
Sub AddEmployee(CURRENT_USER_ID as integer)
Dim myConn As New ADODB.Connection
Dim myRS As New ADODB.Recordset
myConn.Open MySQLConn
myRS.Source = "SELECT EmployeeID FROM TimeCard " & _
"WHERE EmployeeID = " & CURRENT_USER_ID
Set myRS.ActiveConnection = myConn
myRS.CursorLocation = adUseClient
myRS.Open , , adOpenDynamic, adLockOptimistic
If myRS.recordcount = 0 Then
'Add new employee
myRS.AddNew
myRS!EmployeeID = CURRENT_USER_ID
myRS.UpdateBatch adAffectAll
Else
msgbox "Employee already exists!"
End If
myRS.Close
myConn.Close
Set myRS.ActiveConnection = Nothing
End Sub
'---------------------------------------------
This will check to see if the EmployeeID already exists, if it doesn't it adds it to the table.
Aaron