Greetings Access Gods,
I've been away from the IDE for several years due to a medical event and have recently started building a db while trying to re-learn as I go (my meager coding skills have atrophied significantly in the last few years due to lack of use). Anyway, I built an event by which the user can clear the dataset with a few clicks. The problem is that my dialog boxes display integers instead of a string. When I write the title string in the line of code, it errors out. I haven't encountered this issue before... msgbox and inputbox functions are normally ez-pz, but the ones in this sub have me perplexed. Hope you can help, and thanks in advance.
Here's my code:
Code:
Private Sub cmdEraseAllRecords_Click()
Dim strKeyword As String
strKeyword = "CLEAR-ALL"
Dim strUserInputDelRec As String
Do While strUserInputDelRec <> strKeyword
strUserInputDelRec = InputBox("To confirm deletion, type the phrase '" & strKeyword & "' (without quotes) and click OK:", vbOKCancel)
If strUserInputDelRec = strKeyword Then
Exit Do
End If
If strUserInputDelRec = "" Then Exit Sub
If MsgBox("Incorrect entry. Try again?", vbYesNo) = vbNo Then Exit Sub
Loop
CurrentDb.Execute "Delete * From tblMain", dbFailOnError
MsgBox "All records have been successfully deleted.", vbOKOnly, vbInformation
Exit Sub
Me.cmdFirstFocus.SetFocus
End Sub