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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop Up Form Error - Chr(34)

Status
Not open for further replies.

dshannon

Technical User
May 25, 2002
11
0
0
US
I am using a pop-up form to filter a report. The code I am using comes from the Microsoft site. Have used it before, and it works perfectly. Until now. This is the code to set the filter choices:
Private Sub Set_Filter_Click()
Dim strSQL As String, intCounter As Integer
' Build SQL String.
For intCounter = 1 To 3
If Me(&quot;Filter&quot; & intCounter) <> &quot;&quot; Then

strSQL = strSQL & &quot;[&quot; & Me(&quot;Filter&quot; & intCounter).Tag & &quot;] &quot; & &quot; = &quot; & Chr(34) & Me(&quot;Filter&quot; & intCounter) & Chr(34) & &quot; And &quot;
End If
Next

If strSQL <> &quot;&quot; Then
' StripLast &quot; And &quot;.
strSQL = Left(strSQL, (Len(strSQL) - 5))
' Set the Filter property.
Reports![SubcontractorPhonebook].Filter = strSQL
Reports![SubcontractorPhonebook].FilterOn = True
End If
End Sub

When I press the &quot;set filter&quot; button which should run this code, I get an error stating:

&quot;Compile Error: Can't Find Project or Library&quot; and it is highlighting the 'Chr' in the fifth line of the code. Can anyone tell me why and what I can do to make this work?

Thank you in advance. I appreciate any help.

Dianne in VA
 
Within the code window select the TOOLS menu then REFERENCES menu options. Check to see if any dll files are stated as missing. If not then take note of the file location. For example, the &quot;Visual Basic for Applications&quot; file is located in the c:\Program Files\blah blah blah\vba332.dll.

Next you need to re register the dll files.
From the START menu select the RUN option. type in:

regsrv32 &quot;<full dll location>&quot;

where <full dll location> is the c:\Program Files\blah blah blah\vba332.dll. Ensure that the path is enclosed within quotes (&quot;). This will also be the case for any .olb or .ocx files you have included in you references.

P.S ensure that the file is in that location specified!

If this helps, please mark this post as helpful. It would be appreciated.
 
Well, it should produce a &quot; and give you somthing like this in your variable: [tag] = &quot;FilterFor&quot; and

If its highlighting the Chr code.. what have you changed since it was working? New PC perhaps? Or is this copied into a new DB with the references not checked?

HTH's
 
Thank you, Dodgey and SimonJPearson. You both helped me look into areas I did not (and to some extent, still do not) understand. I was able to replace the Chr(34) with double quotations, but now I am being given an error on the 'Left' string line (strSQL = Left(strSQL, (Len(strSQL) - 5)).

This database, unlike the others I have created and used the same pop-up form, was created in Access 97. Could this make a difference as to what code is allowable?

Thanks, again, for your help - both of you.

Dianne in Virginia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top