Question Open form related to newly added record

neideb

Registered User.
Local time
Today, 00:36
Joined
Oct 9, 2001
Messages
42
Hi All,

I have a table to track visit of sellers. I open a form to create new record. I wish to close this form and open another one based on a query that shows all records related to visits of this seller.
Could any member help me on this code?
Private Sub BtnSeeVisits_Click()
On Error GoTo Err_BtnSeeVisits_Click
Dim stLinkCriteria As String 'I do not know if here is variable???
'After update the form I want to refresh and hide it and open another form
that is based in a query
Forms![FrmVisitSeller].Refresh
Forms![FrmVisitSeller].visible = False
'Click BtnSeeVisits to see visits of said seller. I have several sellers. If I put show all records form shows records of all sellers. I need to see visit of the last updated seller...
DoCmd.OpenForm "FrmVisitSellerAllRecords"
stLinkCriteria = "[SellerID]=" & Me![SellerID]
Exit_BtnSeeVisits_Click:
Exit Sub
Err_BtnBtnSeeVisits_Click:
MsgBox Err.Description
Resume Exit_BtnSeeVisits_Click
End Sub
Tks a lot...:confused::confused:
 
thank you Paul. I will let you know what I got.
 
Hello, I got it. I followed yr instructions and it it working great. Tks.
Can I ask another question? I need to close the first form when I open the second one. If I put me.1stform visible.false the code goes to second form and open it, but when I re-open the first form it is still there and freezes my project so I have to close it. Tks for answering.
 
Glad it helped. Have you tried

DoCmd.Close

with the appropriate arguments to close the form instead of hiding it?
 

Users who are viewing this thread

Back
Top Bottom