A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

help with code builder



 
 
Thread Tools Display Modes
  #1  
Old September 22nd, 2004, 12:42 PM
lynn atkinson
external usenet poster
 
Posts: n/a
Default help with code builder

I have set up a button using the wizard which opens
another form and displays the related record. I want this
button to also close the original form when it displays
the related form. Where do I put the code and what do I
say?
the existing code produced by the wizard is as follows:

Private Sub go_to_edit_worker_Click()
On Error GoTo Err_go_to_edit_worker_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "new employee edit"

stLinkCriteria = "[employee ID new]=" & Me![employee
ID new]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_go_to_edit_worker_Click:
Exit Sub

Err_go_to_edit_worker_Click:
MsgBox Err.Description
Resume Exit_go_to_edit_worker_Click

End Sub

I want to close the original form called 'worker details
filter form'

How do I go about this?

regards
  #2  
Old September 22nd, 2004, 01:45 PM
Kevin Sprinkel
external usenet poster
 
Posts: n/a
Default

See VBA Help on the DoCmd object and its methods.

Insert the following line after the DoCmd.OpenForm
statement:

DoCmd.Close acForm, "Your Form Name"

HTH
Kevin Sprinkel


-----Original Message-----
I have set up a button using the wizard which opens
another form and displays the related record. I want this
button to also close the original form when it displays
the related form. Where do I put the code and what do I
say?
the existing code produced by the wizard is as follows:

Private Sub go_to_edit_worker_Click()
On Error GoTo Err_go_to_edit_worker_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "new employee edit"

stLinkCriteria = "[employee ID new]=" & Me![employee
ID new]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_go_to_edit_worker_Click:
Exit Sub

Err_go_to_edit_worker_Click:
MsgBox Err.Description
Resume Exit_go_to_edit_worker_Click

End Sub

I want to close the original form called 'worker details
filter form'

How do I go about this?

regards
.

  #3  
Old September 22nd, 2004, 04:07 PM
fredg
external usenet poster
 
Posts: n/a
Default

On Wed, 22 Sep 2004 04:42:11 -0700, lynn atkinson wrote:

I have set up a button using the wizard which opens
another form and displays the related record. I want this
button to also close the original form when it displays
the related form. Where do I put the code and what do I
say?
the existing code produced by the wizard is as follows:

Private Sub go_to_edit_worker_Click()
On Error GoTo Err_go_to_edit_worker_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "new employee edit"

stLinkCriteria = "[employee ID new]=" & Me![employee
ID new]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_go_to_edit_worker_Click:
Exit Sub

Err_go_to_edit_worker_Click:
MsgBox Err.Description
Resume Exit_go_to_edit_worker_Click

End Sub

I want to close the original form called 'worker details
filter form'

How do I go about this?

regards


DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, Me.Name


--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Print a Tab instruction in "Code 3 of 9" bar code on an Access re. Dwise Setting Up & Running Reports 1 September 9th, 2004 07:23 PM
How to phrase If/Then clauses in the control source field Database Design 13 August 14th, 2004 04:22 PM
Form to generate a Report code Pat Coleman Setting Up & Running Reports 4 July 16th, 2004 12:58 PM
Hide or show Control Button on Form in Access 97 Pete Sperling Using Forms 8 July 13th, 2004 04:13 PM
customizing "documentor" output W Garrard Database Design 12 May 24th, 2004 03:07 AM


All times are GMT +1. The time now is 06:29 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.