Hi,
I get a "run-time error "3464" everytime I Add, Update and Delete a record based on GroupID. In my table the data type for GroupID is number and the other two fields are text. I would like to know how to declare my GroupID filed as an interger or number? BTW, i have no idea about VBA :-) ..please help.
Code:
Option Compare Database
Option Explicit
Dim sql As String
Private Sub cmdAdd_Click()
sql = "INSERT INTO tblGroup(GroupID,Section,Unit) " & "VALUES ('" & GroupID & "','" & txtSection & "','" & txtUnit & "')"
DoCmd.RunSQL (sql)
lst1.Requery
End Sub
Private Sub cmdDelete_Click()
sql = "DELETE FROM tblGroup WHERE GroupID = '" & GroupID & "'"
DoCmd.RunSQL (sql)
lst1.Requery
End Sub
Private Sub cmdUpdate_Click()
sql = "UPDATE tblGroup SET GroupID = '" & GroupID & "', Section = '" & txtSection & "', Unit = '" & txtUnit & "' WHERE GroupID = '" & lst1.Column(0) & "'"
DoCmd.RunSQL (sql)
lst1.Requery
End Sub
Private Sub lst1_Click()
GroupID = lst1.Column(0)
txtSection = lst1.Column(1)
txtUnit = lst1.Column(2)
End Sub