E
enrico via AccessMonster.com
why does my insert statement behind my button is working for a moment then
gives an error then work again then gives an error. the latest error is:
data type mismatch in criteria expression
i can't determine what's the problem because today it'll work and tom. it
might not. this is the code i used anyway:
Dim db As DAO.Database
Dim strSql As String
strSql = ("INSERT INTO tblGenInfo(Lastname, " & _
" Firstname, " & _
" MI, Age, " & _
" Sex, " & _
" CivilStatus, " & _
" MembershipCategory, " & _
" MembershipType, " & _
" Address, " & _
" Hospital, " & _
" DateAdmitted, " & _
" DateDischarge, " & _
" DateofSurvey) " & _
"VALUES ('" & Me.txtLastName & "', " & _
" '" & Me.txtFirstname & "', " & _
" '" & Me.txtMI & "', '" & Me.txtAge & "', " & _
" '" & Me.cboSex & "', " & _
" '" & Me.cboCivilStatus & "', " & _
" '" & Me.cboMemCategory & "', " & _
" '" & Me.cboMemClass & "', " & _
" '" & Me.txtAddress & "', " & _
" '" & Me.cboHospital & "', " & _
" '" & Me.txtDateAdmitted & "', " & _
" '" & Me.txtDateDischarged & "', " & _
" '" & Me.txtDateofSurvey & "')")
Set db = CurrentDb
db.Execute strSql, dbFailOnError
gives an error then work again then gives an error. the latest error is:
data type mismatch in criteria expression
i can't determine what's the problem because today it'll work and tom. it
might not. this is the code i used anyway:
Dim db As DAO.Database
Dim strSql As String
strSql = ("INSERT INTO tblGenInfo(Lastname, " & _
" Firstname, " & _
" MI, Age, " & _
" Sex, " & _
" CivilStatus, " & _
" MembershipCategory, " & _
" MembershipType, " & _
" Address, " & _
" Hospital, " & _
" DateAdmitted, " & _
" DateDischarge, " & _
" DateofSurvey) " & _
"VALUES ('" & Me.txtLastName & "', " & _
" '" & Me.txtFirstname & "', " & _
" '" & Me.txtMI & "', '" & Me.txtAge & "', " & _
" '" & Me.cboSex & "', " & _
" '" & Me.cboCivilStatus & "', " & _
" '" & Me.cboMemCategory & "', " & _
" '" & Me.cboMemClass & "', " & _
" '" & Me.txtAddress & "', " & _
" '" & Me.cboHospital & "', " & _
" '" & Me.txtDateAdmitted & "', " & _
" '" & Me.txtDateDischarged & "', " & _
" '" & Me.txtDateofSurvey & "')")
Set db = CurrentDb
db.Execute strSql, dbFailOnError