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!

Report opens for some... but not for others VBA code help. 1

Status
Not open for further replies.

gabriellec

Programmer
Mar 20, 2001
19
US
We have this form with a button to launch a report (Access 97). When the report opens we want it to filter it with only the first 5 left characters of the field. The code works great on two computers... but does not work on every other one. X-)

So take a look at my code:

________________________________________________
Private Sub deposit_Click()
On Error GoTo Err_deposit_Click

Dim stDocName As String
Dim stFilter As String

stDocName = "Deposit Description Report"
stFilter = "legal = Left([forms]![project form]![legal],5)"
DoCmd.OpenReport stDocName, acViewPreview, , stFilter
Exit_deposit_Click:
Exit Sub

Err_deposit_Click:

Resume Exit_deposit_Click

End Sub
________________________________________________

I have narrowed down the problem to this line of code that is bugged:
stFilter = "legal = Left([forms]![project form]![legal],5)"

any ideas for me?

-Gabrielle
 
without an error number or description to go on, its kind of difficult to say. First thing to check is whether or not you are missing a reference to a Library on the PCs that the code doesn't work on. Open a Module in Design mode, Click on Tools then References from the MenuBar, look for any entry that has "Missing" next to it. If you find one, click on it, and exit the module, then try the report again.

PaulF
 
Paul...

Worked great. Since I had to uncheck two different boxes to get it to work. Will there be any trickle down problems?
 
depends on which Libraries they are, and if you use them in your mdb. Sometimes libraries get referenced during testing and aren't required in the final product. Sometimes you move from one Operating System to another and the DLLs or OCXs are in different locations, and then sometimes Access just loses the connection for apparently no reason, and you need to re-establish the link. If you left the Refences Dialog box without re-checking the two missing Libraries, it might be wise to do additional testing.

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top