Hi there, Im just knocking up a quick Access thing for work - moving data from a field in a form to a table.
Anybody got any ideas why I get this error? "Runtime error (13) - type mismatch"
We're using Windows 2000 and Access 2002...
Cheers
Option Compare Database
Option Explicit
Private Sub cmdSubmitProject_Click()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("select * from tblProjects")
Dim strMessage As String
Dim intOptions As Integer
Dim bytChoice As Byte
Dim Cancel As Integer
strMessage = "Are you sure you wish to reserve this booking?"
intOptions = vbQuestion + vbOKCancel
bytChoice = MsgBox(strMessage, intOptions)
If lblUserID = "" Then
MsgBox ("You must enter a UserID against the project to continue")
If lblProjectName = "" Then
MsgBox ("You must enter a Project title to continue")
If lblDateStarted = "" Then
MsgBox ("You must enter a Project Start date to continue")
If lblProjectDescription = "" Then
MsgBox ("You must enter a Project Description to continue")
Else
rst.AddNew
rst!UserID = lblUserID
rst!ProjectName = lblProjectName
rst!DateStarted = lblDateStarted
rst!ProjectDescription = lblProjectDescription
rst.Update
rst.Close
MsgBox ("Project added to system.")
DoCmd.Close
End If
End If
End If
End If
' If bytChoice = vbOK Then
' DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'
' If bytChoice = vbCancel Then
' FirstName.SetFocus ' Go back to Name field.
' Cancel = True ' Cancel saving the record.
' Else
Exit_SaveRecord_Click:
Exit Sub
Err_SaveRecord_Click:
MsgBox Err.Description
Resume Exit_SaveRecord_Click
End Sub
Anybody got any ideas why I get this error? "Runtime error (13) - type mismatch"
We're using Windows 2000 and Access 2002...
Cheers
Option Compare Database
Option Explicit
Private Sub cmdSubmitProject_Click()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("select * from tblProjects")
Dim strMessage As String
Dim intOptions As Integer
Dim bytChoice As Byte
Dim Cancel As Integer
strMessage = "Are you sure you wish to reserve this booking?"
intOptions = vbQuestion + vbOKCancel
bytChoice = MsgBox(strMessage, intOptions)
If lblUserID = "" Then
MsgBox ("You must enter a UserID against the project to continue")
If lblProjectName = "" Then
MsgBox ("You must enter a Project title to continue")
If lblDateStarted = "" Then
MsgBox ("You must enter a Project Start date to continue")
If lblProjectDescription = "" Then
MsgBox ("You must enter a Project Description to continue")
Else
rst.AddNew
rst!UserID = lblUserID
rst!ProjectName = lblProjectName
rst!DateStarted = lblDateStarted
rst!ProjectDescription = lblProjectDescription
rst.Update
rst.Close
MsgBox ("Project added to system.")
DoCmd.Close
End If
End If
End If
End If
' If bytChoice = vbOK Then
' DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'
' If bytChoice = vbCancel Then
' FirstName.SetFocus ' Go back to Name field.
' Cancel = True ' Cancel saving the record.
' Else
Exit_SaveRecord_Click:
Exit Sub
Err_SaveRecord_Click:
MsgBox Err.Description
Resume Exit_SaveRecord_Click
End Sub