Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA help 1

Status
Not open for further replies.

neilmcmor

Technical User
Aug 9, 2007
30
GB
I am a complete novice at VBA. I have a command button on a form, (PrisonersBySurname), that has the following code attached which opens a new form, (Prisoner_Details). would like to add code that closes the original form when the new form opens. Any ideas?

Private Sub OpenPrisonerDetailsBtn_Click()
On Error GoTo Err_OpenPrisonerDetailsBtn_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Prisoner_Details"

stLinkCriteria = "[Spin]=" & Me![Spin]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OpenPrisonerDetailsBtn_Click:
Exit Sub

Err_OpenPrisonerDetailsBtn_Click:
MsgBox Err.Description
Resume Exit_OpenPrisonerDetailsBtn_Click

End Sub
 
after the code thats opens the form in the calling form add
Code:
docmd.Close acForm ,me.name,acSaveNo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top