M
Madmax via AccessMonster.com
I also am having problems opening a form to a specific record. I have a
single table that because of the amount of data I enter on two different
forms. On form 1 I have a command button to open form 2. On form 1 I have a
name field that is extracted from table A. Form 1 also has a component
number which in combination with the name field is a unique index to extract
data from table B. There is a 1 to many relationship between table A and
table B.
When I get to form 1 I can use the Navigation Button to walk through the
various table 2 entries. When I am on a particular component I may want to
access form 2 that corresponds to form 1. However when I open form 2
supplying both the name and component number parameters I always end up on
form 2, component 1 entry and have to then Navigate to the corresponding
component record. I have been trying to resolve this problem for some time
and have searched the Web, but just can't seem to find an answer to my
problem. Below is the code I used to open form 2.
Dim stFrmName As String
stFrmName = "Add_Edit_TestInformation" '= Form 2 Name
Dim openargs As String
Dim openfilter As String
openfilter = "[TestCaseNumber]= """ & [TestCaseNumber] & """" ' = Name
openargs = "[TestCaseNumber]= """ & [TestCaseNumber] & _
""" AND [TestCaseComponentNumber]= " & [TestCaseComponentNumber] ' =
Component Number
'MsgBox (openargs)
If Me.RecordsetClone.RecordCount > 0 Then
If Not (IsNull([TestCaseComponentNumber])) Then
DoCmd.OpenForm stFrmName, , , openfilter, , , openargs
End If
End If
As I was typing this post, the thought came to me that maybe I should not be
supplying the openfilter parameter?
I should probably also point out that I am a newbie and I am trying to
support and existing product that someone else constructed. Thanks in
advance for any suggestions.
single table that because of the amount of data I enter on two different
forms. On form 1 I have a command button to open form 2. On form 1 I have a
name field that is extracted from table A. Form 1 also has a component
number which in combination with the name field is a unique index to extract
data from table B. There is a 1 to many relationship between table A and
table B.
When I get to form 1 I can use the Navigation Button to walk through the
various table 2 entries. When I am on a particular component I may want to
access form 2 that corresponds to form 1. However when I open form 2
supplying both the name and component number parameters I always end up on
form 2, component 1 entry and have to then Navigate to the corresponding
component record. I have been trying to resolve this problem for some time
and have searched the Web, but just can't seem to find an answer to my
problem. Below is the code I used to open form 2.
Dim stFrmName As String
stFrmName = "Add_Edit_TestInformation" '= Form 2 Name
Dim openargs As String
Dim openfilter As String
openfilter = "[TestCaseNumber]= """ & [TestCaseNumber] & """" ' = Name
openargs = "[TestCaseNumber]= """ & [TestCaseNumber] & _
""" AND [TestCaseComponentNumber]= " & [TestCaseComponentNumber] ' =
Component Number
'MsgBox (openargs)
If Me.RecordsetClone.RecordCount > 0 Then
If Not (IsNull([TestCaseComponentNumber])) Then
DoCmd.OpenForm stFrmName, , , openfilter, , , openargs
End If
End If
As I was typing this post, the thought came to me that maybe I should not be
supplying the openfilter parameter?
I should probably also point out that I am a newbie and I am trying to
support and existing product that someone else constructed. Thanks in
advance for any suggestions.