Problem filtering in Project

S

SAL

Okay, what the heck am I missing on this one. It's been a while since I've
worked in Access. I'm using Access 2003 (a project file) and SQL Server
2005.

I have a form with a subform in it and link between the parent and child
form is working just fine. I open another form when the user clicks a button
(Button_Click event) on the main form with the following code:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmPhoto"
' I've tried it with and without the following two lines of code
Form_frmPhotos.Filter = ""
Form_frmPhotos.FilterOn = False
stLinkCriteria = "VisitID = " & Form_frmVisit!VisitID ' the value here
seems to be accurate according to the current record
DoCmd.OpenForm stDocName, , , stLinkCriteria

The problem is that it only works if I'm on the first record in the main
form. If I move to another record, say where the frmVisit.VisitID = 40,
then, the form "frmPhoto" opens up without any records showing. The form,
frmPhotos' record source is dbo.Photo. If I execute the following query in
SQL Server management studio:

SELECT * FROM dbo.Photo WHERE VisitID = 40

it shows one record in the result.

What gives here? Is there a way to make this work correctly? frmPhoto should
always open up with the record showing where the VisitID = the VisitID on
the subform of the main form....

Thanks
S
 
S

SAL

Doa,
the ServerFilter property was set messing me up....

I'm glad it wasn't just quirky Access...


S
 
A

aaron.kempf

yeah I use ADP a _LOT_ and I almost only ever use the ServerFilter or
a real where clause-- not the typical filter property
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top