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
2129 Views

Similar Articles

[PageSpeed] 24

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:

WHAT IS NAME
WHY ARE TELL TALK ...

Forms Migration
Migrating from Exchange 5.5 to 2003 in the same Exchange Org. I am successfully migrating public folders but the forms associated with these public folders are not showing up when connecting to the new server. How do I migrate the forms? ...

Small Name Box
Hi, The name box in MS Excel is rather small and narrow. Is there a way to expand it ? -- Regards, Adrian Hi Adrian check out http://www.cpearson.com/excel/NameBox.htm Cheers JulieD "Adrian" <xinke@hotmail.com> wrote in message news:OdxnpssdEHA.592@TK2MSFTNGP11.phx.gbl... > Hi, > > The name box in MS Excel is rather small and narrow. Is there a way to > expand it ? > -- > Regards, > Adrian > > ...

Check Name in a Specific Customer Record
Hi, Have to use the after update event of a combox rather than the notinlist event to allow for a third option. Combobox is Combo111 which has a control source [Contact Name]. The combo has a list of names etc which have already been filtered to a company. tblCustContacts has records with fields of Last_Name, First_Name, RecordID, and CUSTID. RecordID is unique. User enters a name "Fred Jones" Jones is filtered out. Now I need to check if Jones is in the list associated with that particular CUSTID. If not - user can choose to add to the list adding details ...

Object variable or With block variable not set
I'm trying to put a command button on a form using the command button wizard and I am getting this message "Object variable or With block variable not set". I cannot figure out what's happening. I tried opening different instances of Access and am getting the same problem with some but not all of my .mdb files. Hope someone can help. Thanks, Laura Laura Its hard to think what it would be with no example... did you edit the code generated by the wizard? or is it the wizard producing the error? Can you paste the code here? cheers Jeff "laura" <replyto@gr...

Use of Worksheet Tab Name
Want to put a new name on a worksheet tab (which I know how to do) and then reference that TAB on the work sheet. For example, if I name a worksheet XYZ, need a process where I can say Cell A1 (or whatever) = TAB NAME (XYZ or anything). How do I do that? one way: =MID(CELL("filename",A1), FIND("]", CELL("filename",A1))+1, 255) In article <Grampa425.sxppz@excelforum.com>, Grampa425 <Grampa425.sxppz@excelforum.com> wrote: > Want to put a new name on a worksheet tab (which I know how to do) and > then reference that TAB on the work sheet. ...

sharing variables between dialog boxes
Hi all, I have a dialog based application where i want to share variables between 2 dialog boxes. More specifically, i have a dialog box with a menu option settings. On pressing that a new dialog box is invoked. This new dialog box has a edit box and save button. User will write into that edit box and press save button. When ever he presses save, the dialog box will close. Now i want the contents of the edit box into the main dialog box from where that dialog box was invoked. How should i go about that??? thanks kunal The class that wraps the 2nd dialog and displays the edit control ...

get computer name, desktop and my document
I would like to get computer name, desktop and mydocuments folder using VBA for my applications. Any function available to do this task? Your information is great appreciated, See http://www.mvps.org/access/api/api0009.htm at "The Access Web" for how to get the computer name, and http://www.mvps.org/access/api/api0054.htm for how to get the location of special folders such as Desktop and MyDocuments. -- Doug Steele, Microsoft Access MVP http://www.AccessMVP.com/DJSteele (no e-mails, please!) "iccsi" <inungh@gmail.com> wrote in message news:1f8...

Report Generation Variables for Date
I'm trying to define a filter in a report, using the last month start and last month end as low and high limits. Can somebody tell me the name of this variables, like <Today> is self explanable. -- alvaroguzman this is all I have: <MonthStart> first day of month <WeekStart> date of first day of this week <LastWeekStart> date of first day of last week <YearStart> first day of year <Now> current date/time <ReportDate> date of report "Alvaro Guzman" <aguzmanc2005@hotmail.com> wrote in message news:7C2DA569-6C0C-420C-9F49-4FC...

Using Popups to supply variables
Hi All I sue this macro to find and replace a number in column I Columns("I:I").Select Selection.Replace What:="5.95", Replacement:="2.95", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False I'd like to replace the values in the macro , requesting variable input via popup. Can someone help? Effectively , there would be popups to request the column , the search number and the replace number. If it could also cycle back to the beginning on completion ...

Form/Subform Problem
I have a bound form with three subforms. Subforms are all displaying in Datasheet View. I am able to make column width changes to all subforms (double-click right border or manually type in a number or drag to size), but after closing main form and reopening, changes are saved on only two of the three subforms. I have checked Properties of all subforms (numerous times) and have everything identical except for the Record Source (Query of each subform). Before closing, I click File/Save on the MenuBar and the Save icon on the Toolbar (I get a working Hourglass on both for three+ second...

3 linked combo boxes in a form Options
Thank you for your response. Unfortunately, the option you suggested did not produce the desired result. Perhaps if I explain further what I am trying to do, you can offer some alternatives. Shopcbo based on Shopqry based on Shoptbl. Columns in the table are ShopName and ShopID. The shop same is self explanatory. The shop ID is a field a created to match up with a field in the equipment table. Areacbo based on Areaqry based on Areatbl. Columns in the table are AreaName, AreaLink and ShopName. The area link is a field created to identify each area that a piece of equipment belongs to...

Enumerate Controls on a Form
I would like code that would enumerate all controls on a form returning their names and types. Thank you. You should be able to figure it out from the code at: http://www.datastrat.com/Download/FixNames2K.zip -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "tcb" <tbenson@mn.rr.com> wrote in message news:1194476215.293996.56820@o3g2000hsb.googlegroups.com... >I would like code that would enumerate all controls on a form > returning their names and types. > > Thank you. > Try the TOOLS - Analyze - Doc...

create a form that collects parameters
Hi, i need a form where we search for a detail and the result should be published in the bottom, based on the result the user will decide what to do next in acess 2007. i refered the link below http://office.microsoft.com/en-us/access/HA100963141033.aspx#form_param in this some mistake is there in the macro can somebody help me out. if any template for search form is available please let me know. thank you, -- Kalai Maybe something like this: http://www.fontstuff.com/access/acctut08.htm This could be very helpful too: http://www.fontstuff.com/access/acctut06.htm Al...

Form to report
I have a form with a listbox and 2 graphs. When an item is selected on the listbox, the chart displays the appropriate informatiom. But when the "preview report" button is selcted at the bottom, the form displays graphs for ALL items in the listbox...not the one selected. I am missing passing something to the report but I don't know what. Here is the code behind the button: Private Sub Command20_Click() Dim stDocName As String stDocName = "rptTrend_HF" DoCmd.OpenReport stDocName, acPreview End Sub -- Message posted via AccessMonster.com ht...

Change the servicecalendar form
I need to change the service calendar form. This form should be customizeable under Serviceactivity and under Ressource. But when this form is opened the result is the Ressource-form and the Serviceactivity form. I also need to make changes to the sevicescheduling form - is this possible ? ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-base...

OLE field on form
How do I get an ole field on a form to display full frame. At the moment, all I can get it to do is show a small (and rather blocky) verion of a .bmp file, with the file name underneath. It won't display .jpg at all - only the file name. I've played with this for a while now. "Paul Doree" <PaulDoree@discussions.microsoft.com> wrote > How do I get an ole field on a form to display full frame. > At the moment, all I can get it to do is show a small (and > rather blocky) verion of a .bmp file, with the file name > underneath. It won...

Names on worksheet
I have a worksheet full of names to reference cells. They are no longer of any value and the VBA they work with is not required and will be removed. With the removal of the VBA (and it must be removed because it causes problems with the way we use the worksheet) the names keep wanting to access the code. They also activate the "links" feature. Is there a quick way of deleting names rather than one at a time? I will have a number of files each with a number of worksheets in them and each one has to have the names removed. Any thoughts. DavidC Hi David, Try: Sub DelN...

Sendinng mail showing a different sender's name
Hi, At my work, we use Outlook 2000. I have my normal email mailbox address andre@companyname.com , but I also have access to another mailbox "info@companyname.com" When I send emails, the mesage always automatically shows the sender as "andre@companyname.com" Is there a way to set the default sender to "info@companyname.com " so that the receiver sees that name and not "andre". I do not want to individually modify each email sent using the "FROM" feature, as this would be time consuming. In my Outlook on my personnal computer, I know h...

Outlook 2007 New Form and Importing
If I create a new form in Outlook 2007 with fields that match custom fields I created in ACT will I be able to import the data in those custom fields from ACT into Outlook 2007? Thanks, Bob Outlook does not support importing custom fields without VBA code to do = so. See http://www.outlookcode.com for examples. --=81 Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. =20 After furious head scratching, BobB asked: | If I create a new form in Outlook 2007 with fie...

Need to import select Access data into Excel using two variables
I have a large amount of data in Access, more than Excel can manage. The data consists of many columns; has Col_1 as unique key 1,2,3,4,5,6,7,8 etc… and contains data that includes Col_2, Col_3, Col_4 etc…. It takes a combination of Col_2 and Col_3 to get the data I want. Col_2 has duplicate values and Col_3 makes the subset unique. One more thing… Col_3, Col_4 etc…may have blanks throughout the table and can’t be changed. I don’t own it. I want to be able to open Excel, type “Number from Col_2” into Col_A , “(Number fromCol_3) or (blank)”into Col_B and have the Col_4, Col_5 etc… d...

Newbie question on variables
I had a coder write me a VBA which was rife with errors and he disappeared on me so I've spent the last few days somehow managed to slog through and make fixes (don't know VBA or coding) However I am stuck on my last fix. Essentially there are a # of functions within a larger one I need to set a variable inside an if/then statement and store it in a cell on the WS to access in a later function. Based on how he wrote to cells I did this wsCert.Cells(targetCertRowNumber, 300).Value = "Name" which worked inside other functions However I get this error ...

Code to clear all CheckNBoxes when a Form loads
I have 20 CheckBoxes on a Form. All are set to Triple State = No. When the Form opens, all CheckBoxes, except one, always has a solid green square in the middle. I check off all CheckBoxes, close the Form, and all will have the tiny green square in there again. Is there some setting that manages this? If not, can I add a snippet of code to clear all CheckNBoxes when the Form loads? Thanks! Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. I'm not sure why they're acting like that, but you can proba...

Name Parsing
I have a field that contains lastname MiddleName and firstname as one field, for example: Smith, Joe, Robert Klein, Kathy Hoffman Chan, Mary, Julie Hoffa, Julie I want to parse out the name field to: [LastName] [MiddleName] [FirstName] As the example shows, the name field may not have the full name. The problem, I have in parsing is when the field only has a last name. Hi Tong, The condition InStr([NameField],",")=0 is true when the NameField doesn't contain a comma and therefore contains only the last name. Parsing data out of a field this complicated is IMO eas...

How to un-concatenate a field with full name
I have a filed called "Contact" that has the full first and last name - is there a way to break this field into 2 fields - "first name", 'last name" ??? How do you find where to split the field? Thanks Take a look at "InStr" function in vba -- sam "Patricia" wrote: > I have a filed called "Contact" that has the full first and last name - is > there a way to break this field into 2 fields - "first name", 'last name" ??? > How do you find where to split the field? > > Thanks Patricia GOOD ...