Form Name as Variable

Hi,

I have the following subroutine:

Public Sub SetMeterBasic(p As Single)
' This subprocedure is used to update the progress meter bar
With Forms![FormA]
   .shpMeterBar.Width = p * .lblMeter.Width
   .lblMeter.Caption = Format(p, "##%")
   .Repaint
End With
End Sub

FormA is a form from which I called the main subroutine of the program which 
then later called this procedure.  Is there a way I can pass a form name to 
Sub SetMeter e.g.  so its first line is Public Sub SetMeterBasic(p As Single, 
FormName as String) where the variable FormName can function as "FormA" does 
in the current procedure.  Also, is there a way the procedure could detect 
what form started the whole set of routines and use that form?

Thanks

0
Utf
6/4/2010 9:36:02 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

1 Replies
2158 Views

Similar Articles

[PageSpeed] 15

Charles wrote:
>I have the following subroutine:
>
>Public Sub SetMeterBasic(p As Single)
>' This subprocedure is used to update the progress meter bar
>With Forms![FormA]
>   .shpMeterBar.Width = p * .lblMeter.Width
>   .lblMeter.Caption = Format(p, "##%")
>   .Repaint
>End With
>End Sub
>
>FormA is a form from which I called the main subroutine of the program which 
>then later called this procedure.  Is there a way I can pass a form name to 
>Sub SetMeter e.g.  so its first line is Public Sub SetMeterBasic(p As Single, 
>FormName as String) where the variable FormName can function as "FormA" does 
>in the current procedure.  Also, is there a way the procedure could detect 
>what form started the whole set of routines and use that form?


Just change the With line to:

With Forms(FormName)

-- 
Marsh
MVP [MS Access]
0
Marshall
6/4/2010 9:18:13 PM
Reply:

Similar Artilces:

A Go To Box in a Form
All I want to do is be able to find a record in the database. Based upon two fields. The help menu says you can put a "Go To" box in a form, but nowhere does it describe how to do that. When you make a new combo box, you can select option #3. That option helps you setup up a record finder based on your choices. Richard To add some to Richard's answer, here is a tutorial that I have that shows you how to implement such a combo box: Combo box to find a record http://www.access.qbuilt.com/html/find_a_record.html Here's a sample that uses a form to...

Custom form for Calendar needs frequent cache clearing
Hi, We have a custom form which our Outlook 03/07 users can enter details of forthcoming change requests. There are 3 tabs on this form normally but we have recently noticed that one of the tabs is intermittently missing. It is easily resolved by manually going to Tools > Options > Other > Advanced options > Custom Forms and then selecting "Clear Cache". The missing tab is then available to the user. Can anyone shed any light on why this cache clearing is required and how we can go about preventing it from being a necessity? Thanks in advance. ...

Merge names from Excel to Publisher postcard
I set up a postcard in Publisher. Yesterday, I was able to merge names and addresses from an excel list so I could easily mail. Today, trying to change the list to a more complete on, I get a pop-up message reading "operation cannot be completed because of dialog or database engine failure. Try later." I've tried copying/renaming the excel file to no avail. Any ideas? Could be your MDAC components This article addresses Word, but it is the same error. WD2002: "Operation Could Not Be Completed Because of Dialog or Database Engine Failure" Error Message When ...

Big list colums naming and repeating when printing
I have a list. How do I set up column names that will repeat in every page when I print like headers? File | Page Setup | Sheet. From there you can designate the Row that contains your headings to repeat on each page. tj "MaR" wrote: > I have a list. How do I set up column names that will repeat in every page > when I print like headers? ...

Embedding excel charts in my C# windows form
I'd like to be able to have my C# windows form have access to excel's charting capabilities. I'd like to be able to define a data set, then feed it to eh excel charting engine, and open a new little graphics window to display the resultant chart. Does anyone have pointers on where to start? -- - Matt Kosorok ...

populate form from listbox
I need to be able to populate a continuous form with multiple records from a multi-select listbox. I have done this before. I remember running into a problem where the listbox has to be bound to a table if you want to multi-select. I am getting the error again for this listbox but cannot get around it! Can anyone explain why a multi-select listbox has to be bound? Maybe your explanation will help me understand better. What /how should I bind it what when all I want to do is open a continuous form displaying selected listbox items (records) already in a table? ...

Rename or Exchange Names
Hi! What is the proper way of renaming a computer in windows 2003 Domain and also changing an old pc with a new one? Hello create_share, Just rename the computer connected to the domain, nothing special. You need to use an account that is able to change the name in AD so at least domain admin. Please define the old OS and new OS where you like to change between, is there a need for applications to run on the new one as on the old machine? Best regards Meinolf Weber Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights. ** ...

Outlook Suggest names file location
Is there any way to expose the entire file of Suggest Names? in Outlook 2002 on XP. I have discovered how to delete one at a time but I would like to edit the entire file? Is this possible? Linda Yep, locate the nk2 file of your profile and rename it to .old -- Roady [MVP] www.sparnaaij.net Microsoft Office and Microsoft Office related News Also Outlook FAQ, How To's, Downloads and more... Tips of the month: -Create your own fully customized Toolbar -Creating a Classic View in Outlook 2003 Subscribe to the newsletter to receive news and tips & tricks in your mailbox! www.spar...

transfer data from one text box in a form to another
how do i transfer data from one text box located on a form to another text box located on a sub-form on the main form. complicated i know. what vba code do i use. any solutions thank you you need to specify if you want to make the operation after which event in subform. then you need to put something like this: [textboxinsubform] = Forms!FormName![texboxinform].text LD -- Lorenzo Díaz Cad Technician "vss85" wrote: > how do i transfer data from one text box located on a form to another text > box located on a sub-form on the main form. complicated i know. ...

Sequential Form Field Number Formula
I am not sure how to do the following. We have project numbers that are made up of 3 parts "C" (representing Customer), "10" (representing last two digits of year), and then a 3 digit number starting with "000". My issues is I need a default that looks adds 1 to the last 3 digits. So if the Project number was C10000 then the default for a new project should be C10001, C10099 becomes C10100, etc. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1 On Sat, 13 Feb 2010 01:21:54 GMT, "szag...

Access 2007
In Access 2003 I can see the property sheet for a form whether the form is in design or form view. It's handy to have a form open and refer to field names or control sources while designing a new form or report. You can see the property info by clicking on any field on the form. However I am now using Access 2007. I can see the property sheet while I am designing my report, but as soon as I switch over to the form the property sheet disappears for the form. Is there a way to show the property sheet for a form while it is open in form view? Mich ...

Store Names on X and Z Reports
After upgrading to 2.0.0123 when I print my X and Z reports they do not show with the store names at the top any more...Can anyone tell me how to fix this issue... Thanks Anthony Laidler Can anyone tell me how to update the x and z report receipt format so that it will show the name of the store at the time...Thanks and Happy Holidays. "Anthony Laidler" wrote: > After upgrading to 2.0.0123 when I print my X and Z reports they do not show > with the store names at the top any more...Can anyone tell me how to fix this > issue... > > Thanks > Anthony Laidler ...

Display name in sending email from CRM 4.0
We are using CRM 3.0 before. When email is sent from CRM 3.0 client, the From: email address is resolved to "CRM User's display name". We have just upgraded to CRM 4.0. CRM 4.0 uses the format xxx@yyyy.com as From in sending email. Is there a way to display the "display name" as "From" instead of actual email address? Thanks. JoF "JoF" wrote: > We are using CRM 3.0 before. When email is sent from CRM 3.0 client, the > From: email address is resolved to "CRM User's display name". We have just > upgraded to CRM 4.0. CR...

I need to populate a sub-form field from the original form
I can't see how to do this. I want to be able to be in form1 and then if I need to use sub-form1, I want to be able to click on the sub-form button and the Primary field be autofilled from form1. For instance, Member ID is the primary key in form1. When I open sub-form1, I want the Member ID to populate in the sub-form. On Fri, 14 May 2010 17:48:01 -0700, Michael <Michael@discussions.microsoft.com> wrote: >I can't see how to do this. I want to be able to be in form1 and then if I >need to use sub-form1, I want to be able to click on the sub-form button an...

Shop Product ?Search form/query Access
I have a form that is based on a query that shows all the products i sell, onthe form i have a search text feild, so i can type in the product then click a button that requerys and only displays the products with that text in, this works fine, but i the form takes a long time to load the first time, is there a way i can have it the form loads with no data then i type in product name then when i clcik the button it loads the data/query. Just looking at ways to speed it up Put the first search field on a separate form where the 'after update' event for the search field opens...

Variables in WHERE clause
I am using SQL Server 2005 and the T-SQL below to select records. If I type in the WHERE clause values (as shown) the query time is 1 second or less. If I use the variables @YearStart and @EndDate in the WHERE clause the query takes 33 seconds. Can someone explain and give me an alternative? Thanks. DECLARE @StartDate datetime; DECLARE @EndDate datetime; DECLARE @YearStart datetime; DECLARE @ItemId varchar(24); SET @StartDate = '8/1/2010'; SET @EndDate = '8/31/2010'; SET @YearStart = '1/1/2010'; SET @ItemId = null SELECT D.PartId, MIN(I.Desc...

Form/Query Question
In Access 2007, I have a table that has the following columns: First Name, Last Name, Date of Birth, Hair Color, Height, Weight, and Current Location. I want to create a form that I can go into and find all of the individuals that were born after 1980 and with brown hair; or possibly all the individuals with brown hair that weigh under 180. Basically I want to be able to search the table based on inserting the specific parameters I want into a form. And then I want to be able to see a report of all the individuals that meet my parameters to print out. How can I go about this? Y...

how do I permanently delete names from Outlook autocomplete?
starting to type in the "To" section populates a drop-down. It has been suggested to arrow down to the address I want to delete and hit the delete button. That removes the name until the computer is restarted for another session. The names return. How do I permanently delete the selected names? These names are not stored anywhere in my contacts list. You need to delete the .NK2 file Windows Vista If you can already see hidden files and folders... 1. Close Outlook. 2. Open My Computer. 3. Browse to C:\Users\<username>\AppData\Roaming\Microsoft\Outl...

SFO Conact Sync without Account or Company Name ?
When the Contacts sync to the Outlook folder, they do not sync the Account Name to the Company name in the Outlook Contact. This means the Account name does not get sync'd to a PDA. Has anyone figured out a way to get around this? thanx . . . . . . . Glen Glen - we are having this same problem. Did you figure out a work around? It looks like there were no replies to your post... Thanks. . . . . . . John "Glen Howie" wrote: > When the Contacts sync to the Outlook folder, they do not sync the Account > Name to the Company name in the Outlook Contact. This means t...

Outlook 2007: Paste
Hello, I know this question has been asked a few times, but I still do not feel I've read a clear explaination. When I see external or internal names in the To line, somtimes they are like Smith, Tom <Tom.Smith@email.com>; Smith, Becky <Becky.Smith@email.com> And if I select them, right click copy, and go into the message body and click paste, it only pastes the display name. I'm not trying to recreate a distribution list. I'm not trying to recover lost contacts. I work with a lot of vendors and act as a bridge between the business and IT, and often I hav...

Kill an App by it's name only ?
Hi: If I know only the user mode application's name (full path), is there a way to terminate it? I'm now using FindWindow to get a HWND and then send a WM_CLOSE. It works fine but I do not like to depend on the Windows Title to kill the application. Thanks for any input. Polaris ...

VB6-rotate form 90 degrees?
I have a problem that could be solved more easily if my VB6 form with a text input field and several drop-down controls can be rotated 90 degrees clockwise. (Monitor is being turned sideways - long story - exploring solutions.) Is this possible with Classic VB? Not just to rotate text on the form, but to rotate the entire form so it looks and functions normally? If so, what commands do I need? Ed "Ed from AZ" <prof_ofwhat@yahoo.com> wrote in message news:a7ed093e-38d2-49f2-a606-f5621b34cf0c@i19g2000pro.googlegroups.com... >I have a problem that could be so...

Junk messages comimg via my website form Please help
A bit long sorry......... I have a form on a page of my website. It gives my possible customers a chance to contact me with enquires or comments. The messages come direct to my email. The problem I am finding is that I am getting messgaes via this well which I think are VERY INAPPROPIATE (if you know what I mean) Does ant one know how I can stop these as I am finding it a little distressing. A customer has also contacted me and said she sent me a messgae which I did not recieve so I am also wondering if there is some kind of possible virus attached. Please help! Naomi Naomi, Hm...

Macro (Print)
I want to develop Print Macros so as to automate selection and printing of multiple named ranges within the same sheet. I'm stymied... Question - How do I call a specific named range? Using the macro I developed (see below), only the 1st cell in the named range prints. Example=>> I have a Budget workbook with 5 sheets (2005-2009). Each sheet has multiples schedules (Income Statement with detail schedules supprting particular line items). I want to print all schedules at one time, thereby enhancing efficiency. The attributes of the ranges may change during developemnt of the w...

Increase Length of Name Box
I use Named Ranges quite a bit. The name box only shows 7 or 8 named ranges then I get a scroll bar. This scrolling makes it difficult when I have many named ranges in a workbook. My question is: Can I increase the length of the Name Box to the full screen so I don't need to scroll so much? Is this possible? Thanks for any assistance in the matter! Tim In MacXL, enter this in the VBE's Immediate Window: CommandBars("Formula Bar").Controls("Name Box").Width = 600 For WinXL, see http://www.cpearson.com/excel/NameBox.htm In article <02cc01c5032f$8...