Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old June 27th, 2008, 08:26 PM
troy_lee@comcast.net
Guest
 
Posts: n/a
Default How to open a template form, name it and save it with VBA

Let's say I have a template form named Form1. I have two text fields
named Month and Year.

Using an event procedure from another form, I want to:

1) Open the template form
2) Name the form based on the concatenated entries of the two text
fields
3) Save the form and leave it open

Thanks in advance.

Troy Lee
  #2  
Old June 27th, 2008, 08:26 PM
Salad
Guest
 
Posts: n/a
Default Re: How to open a template form, name it and save it with VBA

troy_lee@comcast.net wrote:
Quote:
Let's say I have a template form named Form1. I have two text fields
named Month and Year.
>
Using an event procedure from another form, I want to:
>
1) Open the template form
2) Name the form based on the concatenated entries of the two text
fields
3) Save the form and leave it open
>
Thanks in advance.
>
Troy Lee
I have a difficult time understanding your situation. Do you open a
form, enter data into two fields, and then expect to rename itself to
something contained in its textboxes? I don't see how one can rename a
form that it open. Do you?

I'll offer a couple of pointers.
Rename an object
DoCmd.Rename "MyNewFormName", acForm, "MyOldFormName"
Copy an existing object
DoCmd.CopyObject, "MyNewFormName"", acFrom, "MyOldFormName"

My Rarotonga
http://www.youtube.com/watch?v=lNQ1Arc9Nik

  #3  
Old June 27th, 2008, 08:26 PM
troy_lee@comcast.net
Guest
 
Posts: n/a
Default Re: How to open a template form, name it and save it with VBA

On Jun 3, 11:31 am, Salad <o...@vinegar.comwrote:
Quote:
troy_...@comcast.net wrote:
Quote:
Let's say I have a template form named Form1. I have two text fields
named Month and Year.
>
Quote:
Using an event procedure from another form, I want to:
>
Quote:
1) Open the template form
2) Name the form based on the concatenated entries of the two text
fields
3) Save the form and leave it open
>
Quote:
Thanks in advance.
>
Quote:
Troy Lee
>
I have a difficult time understanding your situation. Do you open a
form, enter data into two fields, and then expect to rename itself to
something contained in its textboxes? I don't see how one can rename a
form that it open. Do you?
>
I'll offer a couple of pointers.
Rename an object
DoCmd.Rename "MyNewFormName", acForm, "MyOldFormName"
Copy an existing object
DoCmd.CopyObject, "MyNewFormName"", acFrom, "MyOldFormName"
>
My Rarotongahttp://www.youtube.com/watch?v=lNQ1Arc9Nik
For anyone with a similar issue, here is the code I came up with. It
works well. This is coming from what I call the initiation form. This
collects a few key pieces of information. A template form is copied
and renamed to the variable strTitle.

Private Sub cmdCreateScorecard_Click()
Dim strTitle As String

strTitle = Me!cboSelectMonth & " " & Me!txtEnterYear

DoCmd.CopyObject , strTitle, acForm, "Copy of
frmSummaryScorecardTemplate"
DoCmd.OpenForm strTitle, , , , acFormEdit

End Sub
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles