Queried Form Results Open Another Form to Specific Record

ewong1

Eric Wong
Local time
Yesterday, 16:55
Joined
Dec 4, 2004
Messages
96
I currently have two forms: frmE_SAFind and frmE_SAOrderDataEntry

frmE_SAFind shows results from a query including fields [txtIDPO] and [dtmDate]
Example:
btnOpnFrm IDPO Date
btnOpnFrm 6543 2/1/05
btnOpnFrm 5681 1/1/05

frmE_SAOrder shows order details including [txtIDPO] and [dtmDate]

I have a open form command button set up on [frmE_SAFind] that opens [frmE_SAOrderDataEntry].

Here is the existing Code in my OnClick() Command:

Code:
Private Sub btnOpenForm_Click()
On Error GoTo Err_btnOpenForm_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmE_SAOrderDataEntry"
    
    If IsNull(Me!IDPO) Then
     MsgBox "Select a valid PO."
     Exit Sub
    Else
     stLinkCriteria = "[IDPO]=" & "'" & Me![IDPO] & "'"
    End If
    
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_btnOpenForm_Click:
    Exit Sub

Err_btnOpenForm_Click:
    MsgBox Err.Description
    Resume Exit_btnOpenForm_Click
    
End Sub

Is it possible for me to modify its properties so that when the open form command button is clicked, the order details in [frmE_SAOrder] will represent the order that the user is selecting via the btnOpnFrm command?

Example: If I click btnOpnFrm for 6543, [frmE_SAOrderDataEntry] will show me PO 6543 details.

Hopefully I made myself clear enough to understand. Thanks for your help!
 

Users who are viewing this thread

Back
Top Bottom