form id to open/match

  • Thread starter LDA via AccessMonster.com
  • Start date
L

LDA via AccessMonster.com

Hello
This may be quite simple, I am just having trouble executing what I would
like to have happen. I have a form for input. I would like that form to open
on the same Order ID of a form that already opened. If there is no OrderID
than I would like for that orderid to be placed there for input of all other
fields.

LDA
 
L

Linq Adams via AccessMonster.com

In The calling form

Private Sub Go2FormB_Click()
If Not IsNull(Me.OrderID) Then
DoCmd.OpenForm "TableB", , , , , , Me.OrderID
Else
MsgBox "A Visit ID Must Be Entered First!"
End If
End Sub


In the called form

Private Sub Form_Load()

If Not IsNull(Me.OpenArgs) Then
Set rst = Me.RecordsetClone

rst.FindFirst "[OrderID] = '" & Me.OpenArgs & "'"
'rst.FindFirst "[OrderID] = " & Me.OpenArgs ' Use this for a Numeric ID
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
Else
DoCmd.GoToRecord , , acNewRec
Me.OrderID = Me.OpenArgs
End If

rst.Close
Set rst = Nothing
End If

End Sub
 
L

LDA via AccessMonster.com

Thanks Linq
However I have a couple of questions.
The form that is doing will open once the other is open and allow input is
called Duke_Vendor_Dispatch_Status

The Form that Duke_Vendor_Dispatch_Status needs to match based on order id is
called Orders_Sampledetails.

my question is: Duke_Vendor_Dispatch_Status = to FormB??? or is
Orders_Sampledetails equal to Form B?

LDA


Linq said:
In The calling form

Private Sub Go2FormB_Click()
If Not IsNull(Me.OrderID) Then
DoCmd.OpenForm "TableB", , , , , , Me.OrderID
Else
MsgBox "A Visit ID Must Be Entered First!"
End If
End Sub

In the called form

Private Sub Form_Load()

If Not IsNull(Me.OpenArgs) Then
Set rst = Me.RecordsetClone

rst.FindFirst "[OrderID] = '" & Me.OpenArgs & "'"
'rst.FindFirst "[OrderID] = " & Me.OpenArgs ' Use this for a Numeric ID
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
Else
DoCmd.GoToRecord , , acNewRec
Me.OrderID = Me.OpenArgs
End If

rst.Close
Set rst = Nothing
End If

End Sub
 

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