I suddenly started getting this error message after my database has been used for years. Each year we copy the last mdb file and load the current year's accounting data. The problem is occuring in my user interface form when user clicks a button to run a history report for the natural class that is being worked on in current form. This has always worked. The code behind the history button starts out with dim statements, then three Input boxes, then an evaluation of the user's response from Input box (all very usual): here it is:
Dim strNCDefault As String, strYearDefault As String, strRespDefault As String
Dim NCResponse As String
Dim YearResponse As String
Dim RespResponse As String
Dim strYear As String 'holds final form of what user selected
Dim adstrYear As String 'hold ADO which could have ADO specific wildcards
Dim strResp As String 'holds final form of what user selected
Dim adstrResp As String 'hold ADO where wildcards could be used - different from Jet 4.0
Dim strWhere As String
Dim adstrWhere As String 'hold ADO where clause which differs from Jet 4.0 SQL
Dim strOpenArgs As String 'passed to Open Report method to display in report header
Dim strSQL As String
Dim rs As ADODB.Recordset
' Set defaults for NC, year, and responsible organization. Resp can now be Corp or XYZ orgn.
strNCDefault = Me.NC
strYearDefault = "All years"
strRespDefault = "Corp"
' Ask user for NC, Year, and Responsible organization
NCResponse = InputBox("Specify NC", "Run NC History", strNCDefault)
YearResponse = InputBox("Specify year (e.g. 2007)" & vbCrLf & "or Enter for All Years", "Run NC History", strYearDefault)
RespResponse = InputBox("Specify RESP (Corp, B-XYZ, B-ABC, B-DEF, B (for all 'B' Resp's), or ALL)", "Run NC History", strRespDefault)
If YearResponse = strYearDefault Then
strYear = "*"
adstrYear = "%"
strOpenArgs = "All " & NCResponse
Else
strYear = YearResponse
adstrYear = YearResponse
strOpenArgs = YearResponse & NCResponse
End If
The error pops up near the end on line "If YearResponse = strYearDefault Then".
I checked the values in YearResponse and in strYearDefault by hovering the mouse, and there are exactly the same.
Thanks for any assist you can think of.
Oh, I am using Windows XP, Access 2007 but file is format 2003, VBA References are Visual Basic for Apps, Microsoft Access 12.0 Obj Library, OLE Automation, MS DAO 3.6 Obj Lib, and MS Active Data Objects 2.8 Lib.
Jeff
Dim strNCDefault As String, strYearDefault As String, strRespDefault As String
Dim NCResponse As String
Dim YearResponse As String
Dim RespResponse As String
Dim strYear As String 'holds final form of what user selected
Dim adstrYear As String 'hold ADO which could have ADO specific wildcards
Dim strResp As String 'holds final form of what user selected
Dim adstrResp As String 'hold ADO where wildcards could be used - different from Jet 4.0
Dim strWhere As String
Dim adstrWhere As String 'hold ADO where clause which differs from Jet 4.0 SQL
Dim strOpenArgs As String 'passed to Open Report method to display in report header
Dim strSQL As String
Dim rs As ADODB.Recordset
' Set defaults for NC, year, and responsible organization. Resp can now be Corp or XYZ orgn.
strNCDefault = Me.NC
strYearDefault = "All years"
strRespDefault = "Corp"
' Ask user for NC, Year, and Responsible organization
NCResponse = InputBox("Specify NC", "Run NC History", strNCDefault)
YearResponse = InputBox("Specify year (e.g. 2007)" & vbCrLf & "or Enter for All Years", "Run NC History", strYearDefault)
RespResponse = InputBox("Specify RESP (Corp, B-XYZ, B-ABC, B-DEF, B (for all 'B' Resp's), or ALL)", "Run NC History", strRespDefault)
If YearResponse = strYearDefault Then
strYear = "*"
adstrYear = "%"
strOpenArgs = "All " & NCResponse
Else
strYear = YearResponse
adstrYear = YearResponse
strOpenArgs = YearResponse & NCResponse
End If
The error pops up near the end on line "If YearResponse = strYearDefault Then".
I checked the values in YearResponse and in strYearDefault by hovering the mouse, and there are exactly the same.
Thanks for any assist you can think of.
Oh, I am using Windows XP, Access 2007 but file is format 2003, VBA References are Visual Basic for Apps, Microsoft Access 12.0 Obj Library, OLE Automation, MS DAO 3.6 Obj Lib, and MS Active Data Objects 2.8 Lib.
Jeff