When I execute this subroutine, I get the message "Type Mismatch" pointing to the first line after the DoCmd statement, WHAT AM I DOING WRONG? I am trying to read the table Tatno, stored the values locally and then update one of the fields (tatnumber) and close the table.
NOTE: The table named Tatno has two fileds only as follows:
tatyear as TEXT 4 characters long
tatnumber as long numeric
---------------------------------------------------------------------------------------------------
Private Sub Add_Record_Click()
On Error GoTo Err_Add_Record_Click
Dim strYear As Variant
Dim lngNumber As Long
Dim strNumber As String
DoCmd.OpenTable "Tatno", acViewNormal, acEdit
lngNumber = [Tatno]![tatnumber]
strYear = [Tatno]![tatyear]
[Tatno]![tatnumber] = [Tatno]![tatnumber] + 1
DoCmd.Close acTable, "Tatno", acSavePrompt
strNumber = Right(Str(lngNumber), 5)
[Tatno] = strYear + strNumber + " "
MsgBox "The TAT No. for this Petitons is: " + _
"(" + [Level] + "" + strYear + "-" + _
strNumber + " (" + Left([Tax], 2) + ""
[Record_Date] = Date
DoCmd.GoToRecord , , acNewRec
Exit_Add_Record_Click:
Exit Sub
Err_Add_Record_Click:
MsgBox Err.Description
Resume Exit_Add_Record_Click
End Sub
---------------------------------------------------------------------------------------------------
NOTE: The table named Tatno has two fileds only as follows:
tatyear as TEXT 4 characters long
tatnumber as long numeric
---------------------------------------------------------------------------------------------------
Private Sub Add_Record_Click()
On Error GoTo Err_Add_Record_Click
Dim strYear As Variant
Dim lngNumber As Long
Dim strNumber As String
DoCmd.OpenTable "Tatno", acViewNormal, acEdit
lngNumber = [Tatno]![tatnumber]
strYear = [Tatno]![tatyear]
[Tatno]![tatnumber] = [Tatno]![tatnumber] + 1
DoCmd.Close acTable, "Tatno", acSavePrompt
strNumber = Right(Str(lngNumber), 5)
[Tatno] = strYear + strNumber + " "
MsgBox "The TAT No. for this Petitons is: " + _
"(" + [Level] + "" + strYear + "-" + _
strNumber + " (" + Left([Tax], 2) + ""
[Record_Date] = Date
DoCmd.GoToRecord , , acNewRec
Exit_Add_Record_Click:
Exit Sub
Err_Add_Record_Click:
MsgBox Err.Description
Resume Exit_Add_Record_Click
End Sub
---------------------------------------------------------------------------------------------------