Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String compare problem

Status
Not open for further replies.

linsu

Programmer
Jun 28, 2005
7
US
Hi
The program suddenly stopped working and giving the error message at the line of code where two strings are compared. The error message is:
=========================
Run-time error '5':
Invalid procedure call or argument
=============================

The Error was on the line
=> If Me.RecordSource = "Table_1" Then

Part of the source code is:
--------------------------
Option Explicit
Option Compare Database


Private Sub Setup_rs()

If rs Is Nothing Then
=> If Me.RecordSource = "Table_1" Then
Set rs = CurrentDb.OpenRecordset("Table_2")
Else
Set rs = CurrentDb.OpenRecordset("Table_1")
End If
End If

End Sub
------------------------

If I commented out the line
'Option compare database
then, then it does not give any error. I don't understand why there is problem in comparing two strings. By the way, I am using ACCESS 2000 and it was working fine before.
Any suggestions? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top