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
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