C
cableguy47905 via AccessMonster.com
I am trying to open a new form that is based on a query that gets its
criteria from the original form that was performing the "open" action.
I have a subform in datasheet view that has MapID and other data. When I
DblClick on MapID of one of the records, I want it to open a new new form
based on criteria in that subform.
stlinkcriteria = txtMapID.value
If MapStatus = "Complete to Production" Then
If MapRequest = "New Map" Then
stOpenArgs = "ContractNumber = "& Me.[txtContractNumber] & ";MapID =" & Me.
[txtMapID] & ";MapRequest="& Me.[txtMapRequest]
' Here I need to be able to add a suffix to the MapID value that I will be
carrying over. I need to concatenate "Rev" to the end of it.
Open FRM_ContinueRevMapRequest,stlinkcriteria,stOpenArgs
End If
Else
If MapRequest = "New Map" Then
stOpenArgs = "ContractNumber = "& Me.[txtContractNumber] & ";MapID =" & Me.
[txtMapID] & ";MapRequest="& Me.[txtMapRequest]
Open FRM_ContinueNewMapRequest,stlinkcriteria,stOpenArgs
Else
stOpenArgs = "ContractNumber = "& Me.[txtContractNumber] & ";MapID =" & Me.
[txtMapID] & ";MapRequest="& Me.[txtMapRequest]
Open FRM_ContinueRevMapRequest,stlinkcriteria,stOpenArgs
End If
End If
That is not the code exactly, but it is very close to what I have been trying.
I have made so many changes to it now, that I don't even know where to go
next.
Originally I was able to pass over the arguments, but they were not going
into the default values for those fields, and the form was not being filtered.
It would still show all records in the query. The only way I could get it to
filter would be to add [Please enter the MapName] to the criteria field in
the uery and then I would get the pop up. I want to avoid that.
The following would be what I had for the opening code on the other form.
Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs & "" <> "" Then
MsgBox Me.OpenArgs
End If
Dim intLoop As Integer
Dim varOptions As Variant
Dim varValue As Variant
If IsNull(Me.OpenArgs) = False Then
varOptions = Split(Me.OpenArgs, ";")
For intLoop = LBound(varOptions) To UBound(varOptions)
varValue = Split(varOptions(intLoop), "=")
If UBound(varValue) > 0 Then
Select Case varValue(0)
Case "ContractNumber"
Me.TxtContractNumber.DefaultValue = varValue(1)
Case "MapID"
Me.txtMapID.DefaultValue = varValue(1)
Case "MapRequest"
Me.txtMapRequest.DefaultValue = varValue(1)
End Select
If UBound(varValue) > 0 Then
End If
End If
Next intLoop
End If
End Sub
The biggest thing I was having trouble with was the filtering of the query.
I think I could probably eventually figure out how to pass the correct data
with the concatenation.
Any help would be greatly appreciated.
Thanks,
Lee
criteria from the original form that was performing the "open" action.
I have a subform in datasheet view that has MapID and other data. When I
DblClick on MapID of one of the records, I want it to open a new new form
based on criteria in that subform.
stlinkcriteria = txtMapID.value
If MapStatus = "Complete to Production" Then
If MapRequest = "New Map" Then
stOpenArgs = "ContractNumber = "& Me.[txtContractNumber] & ";MapID =" & Me.
[txtMapID] & ";MapRequest="& Me.[txtMapRequest]
' Here I need to be able to add a suffix to the MapID value that I will be
carrying over. I need to concatenate "Rev" to the end of it.
Open FRM_ContinueRevMapRequest,stlinkcriteria,stOpenArgs
End If
Else
If MapRequest = "New Map" Then
stOpenArgs = "ContractNumber = "& Me.[txtContractNumber] & ";MapID =" & Me.
[txtMapID] & ";MapRequest="& Me.[txtMapRequest]
Open FRM_ContinueNewMapRequest,stlinkcriteria,stOpenArgs
Else
stOpenArgs = "ContractNumber = "& Me.[txtContractNumber] & ";MapID =" & Me.
[txtMapID] & ";MapRequest="& Me.[txtMapRequest]
Open FRM_ContinueRevMapRequest,stlinkcriteria,stOpenArgs
End If
End If
That is not the code exactly, but it is very close to what I have been trying.
I have made so many changes to it now, that I don't even know where to go
next.
Originally I was able to pass over the arguments, but they were not going
into the default values for those fields, and the form was not being filtered.
It would still show all records in the query. The only way I could get it to
filter would be to add [Please enter the MapName] to the criteria field in
the uery and then I would get the pop up. I want to avoid that.
The following would be what I had for the opening code on the other form.
Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs & "" <> "" Then
MsgBox Me.OpenArgs
End If
Dim intLoop As Integer
Dim varOptions As Variant
Dim varValue As Variant
If IsNull(Me.OpenArgs) = False Then
varOptions = Split(Me.OpenArgs, ";")
For intLoop = LBound(varOptions) To UBound(varOptions)
varValue = Split(varOptions(intLoop), "=")
If UBound(varValue) > 0 Then
Select Case varValue(0)
Case "ContractNumber"
Me.TxtContractNumber.DefaultValue = varValue(1)
Case "MapID"
Me.txtMapID.DefaultValue = varValue(1)
Case "MapRequest"
Me.txtMapRequest.DefaultValue = varValue(1)
End Select
If UBound(varValue) > 0 Then
End If
End If
Next intLoop
End If
End Sub
The biggest thing I was having trouble with was the filtering of the query.
I think I could probably eventually figure out how to pass the correct data
with the concatenation.
Any help would be greatly appreciated.
Thanks,
Lee