passing a name of the form to a function

I have a function, and would like to pass a name of the form to it so
I can search for a particular name of a page of the form:

Public Sub Multipage_page_finder(form As String, page_name As String)

MsgBox form
MsgBox page_name
For i = 0 To (Controls(form).MultiPage_main.pages.count - 1)
    If Controls(form).MultiPage_main.pages(i).Name = page_name Then
        'MsgBox "found"
        Controls(form).MultiPage_main.Value = i
    End If
Next i

End Sub

What I have to modify?

0
vukblagojevic
3/19/2007 6:06:29 PM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies
671 Views

Similar Articles

[PageSpeed] 9

On 19 Mar 2007 11:06:29 -0700, vukblagojevic@gmail.com wrote:

>I have a function, and would like to pass a name of the form to it so
>I can search for a particular name of a page of the form:
>
>Public Sub Multipage_page_finder(form As String, page_name As String)
>
>MsgBox form
>MsgBox page_name
>For i =3D 0 To (Controls(form).MultiPage_main.pages.count - 1)
>    If Controls(form).MultiPage_main.pages(i).Name =3D page_name Then
>        'MsgBox "found"
>        Controls(form).MultiPage_main.Value =3D i
>    End If
>Next i
>
>End Sub
>
>What I have to modify?

You cannot use a reserved VBA word such as "form" as a variable name.

--
Bob Hairgrove
NoSpamPlease@Home.com
0
Bob
3/19/2007 6:21:29 PM
Try
Public Sub Multipage_page_finder(frm as form , page_name As String)

then refer to form as frm.

Damon

<vukblagojevic@gmail.com> wrote in message 
news:1174327589.462446.28240@l77g2000hsb.googlegroups.com...
>I have a function, and would like to pass a name of the form to it so
> I can search for a particular name of a page of the form:
>
> Public Sub Multipage_page_finder(form As String, page_name As String)
>
> MsgBox form
> MsgBox page_name
> For i = 0 To (Controls(form).MultiPage_main.pages.count - 1)
>    If Controls(form).MultiPage_main.pages(i).Name = page_name Then
>        'MsgBox "found"
>        Controls(form).MultiPage_main.Value = i
>    End If
> Next i
>
> End Sub
>
> What I have to modify?
> 


0
Damon
3/19/2007 7:06:04 PM
Reply:

Similar Artilces:

How to update one form when closing another ?
I have two forms open. frmPeople has the Focus frmAccount does not. frmAccount has subFormPeopleList I add a new person to frmPeople (which is linked to frmAccount) Question 1: When I close frmPeople I want to update frmAccount so the new person shows in subFormPeopleList Quetion 2: But I'm also wondering if I add code to the "close event" for frmPeople to update frmAccount What will this do if frmAccount is not open? Will it add the person twice? I'm guessing not as updating a form doesn't really add data to the table... right? Thanks for any help. Mel Thanks...

Save Workbook Under Custom Name
I have came across assistance to save a workbook using a macro which will save a workbook with a name typed in a specific cell. It works nicely, but I want to specify also the path and sub-directory in which the file must be saved. I have used the following code ActiveWorkbook.SaveAs Range("Name").Value The contents in Range "Name" will be the file name, but it will safe the workbook under the new name in the same directory in which the master file is allocated. Once I am able to specify the path, I want to expand my macro to clear all ranges as well, then the master wi...

Retrieving a file name quickly
In VC 6++ MFC, how do I quickly retreive the first file name (sorted ascending) from a directory? Should I be using CFileFind to get a list of file names from a directory and then sort the list? This doesn't seem to be efficent since I'm looking for one file name. >In VC 6++ MFC, how do I quickly retreive the first file name (sorted >ascending) from a directory? > >Should I be using CFileFind to get a list of file names from a directory and >then sort the list? This doesn't seem to be efficent since I'm looking for >one file name. Charles, That'...

Passing Parameter to Transform of XML to XML
The following transformation puzzles me when trying to transform XML to XML. I get an exception "THE EXPRESSION PASSED TO THIS METHOD SHOULD RESULT IN A NODESET" at the last line "xmlDoc.Load(xr)" when I run the code. I previously tried it all without a parameter and hard-coded the value into the 'apply-templates' statement and the tranform produced the result that I expected but when I inset the parameter I get the exception. I would appreciate it if someone could look over the code and identify which part of the code causes the fault I use VB.NET 2003 and .NE...

Lease agreement forms
Is there any template forms I can get for leasing an apartment? I am looking for a roommate, and I need a form for potential roommates to sign and have some sort of lease agreement. I am renting out an extra room in my house. Thanks! Try this here: http://office.microsoft.com/en-us/templates/results.aspx?qu=rental&av=TPL000 And more specifically this one: http://office.microsoft.com/search/redir.aspx?assetid=TC010014651033&QueryID=GtNChmW1K0&respos=5&rt=2&pid=CT101481321033 -- Bob Larson Access World Forums Super Moderator Utter Access VIP Tutorials at http://www.bta...

Mail Merge using Named Range in Excel
Having trouble completing a mail merge in Word using an Excel spreadsheet. In the spreadsheet there are named ranges, I have included the column headings by defining the range that is non-contiguous (not next to each other). When I go to complete the merge, the range will not show up as an option to use. If I re-define the range to not include the column headings and the range is a block of cells next to each other, the merge still doesn't work correctly, it assumes the merge assumes the row above the range is the column heading row (i.e. range is A16:J101, it uses row 17 as the column ...

writing more than one javascript functions for OnSave of an entity
Hi, I want to check whether value of an attribute (field) for an entity is null or not. I want to 'trim' the value before checking. As there is no built in trim function with javascript, I have a seperate function. I want this function to be available to whole javascript code so that I can check the values for all the required attributes. Where should I put this seperate trim function? regards... Hi, My favourite way is to dynamically define function in onLoad event and than use it in the Form, may be in onChange event. But this function will only be available in that partic...

Having Formatting Remain on "Called" cell using IF function
I'm using an IF function to call some other cells, but I want to have the various words color coded, eg ("Certified" is green, "Recertify" is yellow, and "Not Certified" is red). I have the IF function working correctly, but when it "calls" the cell to have it display the appropriate word, the color of each word is not brought along with it...only the text. Is there a way to be able to color code it so that the appropriate color appears? Thanks! -- Zaraf ------------------------------------------------------------------------ Zaraf's Profi...

after apply filter show blank form.How to detect 0 records??
hi I Have a form , and the user goes to filter by form and then apply filter. When no rows are returned a blank form is displayed how do I detect this and display a message 'no rows found'? mike Mike, I would like to say add a piece of line to your code... DCount("SomeField","SomeTable") < 0 Then MsgBox Esle run your filter but you didn't post any code. Perhaps that little tidbit I posted is enough to get you started? -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been denied critical, need to know, information!&quo...

Formula name
Hello, For the life of me, I can't figure out how to copy/paste a formula into the Name>Define>Refers To box. I've used named formulas many times but just typed the formula in. This formula is very long and complex and I just don't feel like typing it into the Refers To box. Can someone 'guide' me through this please? It's got to be simple but I'm overlooking something. TIA Sandy Sandy, copy the formula and use Ctrl v to put it in the refers to box -- Paul B Always backup your data before trying something new Using Excel 2000 & 97 Please post a...

Create Table Record on Current of Form
I have a table called LastVisitedRecord. There is but one field in that table called "lvCompanyID". I'd like to use the OnCurrent event of my record form to insert the record id (CompanyID) into a new record in the LastVisitedRecord table. After that, I'd like to use a query I've created qLastVisitedRecord which only shows the top 1 record of the LastVisitedRecord table to query my contact form by default, showing all records, but skipping to the record whose CompanyID field matches the sole record in the query qLastVisitedRecord. Anybody got an idea on how to do this? ...

If conditions for Data Entry Form
I have a excel database that I track multiple entries based on customer ID #s. Depending on the ID # depends on what sheet the data goes on. Each sheet is set up the same way, in a couple of the columns I have the vlookup formula that looks up the ID # that is typed in and if it is listed on the appointment sheet, that sheet tracks all the appointments, the vlookup (in column A of all the sheets) will display the appointment date (if one exist) otherwise it would be blank. What I need to know is two things: First is it possible to have the form put the new data on the proper s...

Tabs in forms 09-25-07
I have an input form, pretty standard - main form, subform. First time through tab order is correct. Second and consequent time through it skips the first tab stop in the subform. I have never had this happen on a form. Don't know where to look for the answer. I have checked the tab order and it looks fine. I have checked the properties and the tab order numbers are correct. Can anyone shed light on this? Thanks, -- Taylor ...

How to freeze a form?
Greeting, I have a form that contains many txtbox and combo boxes. In this form there is a commend button to open another form. The problem is, the user can click on the back form (main form) and it come forward and the other form goes back. What I want to do is, once the user open the sub form, the user can not click on the backward form (main form) unless he closes the foreword form. How can I do that? thanks "ghost" <ghost@discussions.microsoft.com> wrote in message news:F1F79916-B8F4-41BE-BD3B-B57F90B513CB@microsoft.com... > Greeting, > I have a form that cont...

sending this information on a form to somewhere secure such as an email account
Hi. I just wanted to make a log book where staff record times that the log in and out of work. I was wondering if anyone knows how to sen off the current time, member of staff (with their own password)t somewhere secure where staff cant get at it...like the managers emai account (if you have any other suggestions, for alternatives to a email account LMK). thanx for your time -- Message posted from http://www.ExcelForum.com ...

Images on Forms
Does anyone know if an image can be added to a form? For example, we'd like to put an image of our 3-party supplier items on their records in the product catalog. I'm currently going down the path of the IFRAME and linking to the supplier website, but I'd like something cleaner. I'm on 3.0 currently but will be upgrading to 4.0 soon, so if it can be in 4.0 I can wait. Thanks. -- BC My suggestion would be to add you image as a note from the related record and retrieve it at-runtime using client side script (web service call) or any custom aspx page from a menu entry...

Function that meets table requirement then multiplies by table fac
I'm looking for a function that will reference a cell then lookup that cell in a table and use the multiplier in the table. I'm not explaining very well so Im hoping that my example will help you understand: Column A b c Sector P&L w/o Admin P&L w/ Admin PC 517.9 PC 0.0 PC 0.0 TD 1,993.6 TD (2,508.0) TS 431.3 TS 355.7 Table reference: FD 1.20 PC 1.03 PR 1.52 SIJ 1.00 TD 1.32 TS 1.63 In column C I would like to put a formula that; if column A mactches column A in table reference th...

Public Folder Directory Name Attribute
Can you edit the directory name attribute of a public folder in Exchange 2003? ...

compile error on previously functioning code outlook 2003 windows
Hello everyone, I have some Outlook 2003 VBA Macros that were functioning just fine in Windows XP & Vista. When I copied them to Windows 7, I now get compile errors on some common functions (left, right, lcase, etc). The macros I have in Word still function with no apparent problem. I've re-installed Office & still get the same problem. I would appreciate any suggestions you have. Thanks, Celeste Check Tools/References. Visual Basic For Applications, and OLE Automation must be checked. -- Best regards Michael Bauer - MVP Outlook Category Ma...

Modifying Forms
Is there a way to relabel the label colors on the Appointment form? Do you mean to modify them or what? Modifying the label names is very easy. Right click on an appointment->Label->Edit Label. I presume you are using Outlook 2002 or 2003, correct? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Cindy MIkeworth asked: | Is there a way to relabel the label col...

Blank forms 01-06-10
Hi, I recently took over our Access 2003 Database from our guy that got laid off and I am a newbie++. I am having a problem with a form. I have a form then I have a subform embedded within that. When I log in with the developer account, I can see the form, but the area where the sub form is is greyed out. When I log in as a user and try to open the form, I have a completely blank window. When I am looged in as developer and look at the form in Design view can I can see all of the fields in the subform that are supposed to be there, but in Form view it magically becomes grey. I ha...

Matching Names
Hi, I have a spreadsheet that contains a long list of staff names with data as follows: A B C Month Employee Name Monthly Salary From this list I want to create another 11 lists of monthly joiners and same for monthly leaversas follows: Monthly Joiners Lists: February Joiners March Joiners Employee Name Monthly Salary Employee Name Monthly Salary Under Employee Name I need a formulae that picks staff appear in February for the first time, and same applies for March, April, etc. Month...

How to sign macros and functions
Dear All What should I do to get my macros and functions signed? Thanks in advance, Paul You would need a third-party digital certificate, for e.g. verisign provides one. https://securitycenter.verisign.com/celp/enroll/retail;jsessionid=DGfqLGyp2G oLIVMJJ7cQUhN8pHl1uK2L8X6ho7EPX1eWbeWYPTtG!-684761666 http://www.verisign.com/products-services/security-services/code-signing/dig ital-ids-code-signing/index.html Mangesh "Paul Smith" <phhs80@gmail.com> wrote in message news:1128685091.539994.205590@g44g2000cwa.googlegroups.com... > Dear All > > What should I do to...

How do I get the WORKDAY function?
I am trying to translate a successful Lotus 1-2-3 spreadsheet into Excel. It ain't easy! I typed =WORKDAYS and #NAME? popped up. This is just one frustration among many I've had with this "leading product" I don't speak Lotus, but there is an =Workday() in the analysis toolpak (along with =networkday()). Excel's help for =workday() explains how to load the analysis toolpak. jorfo wrote: > > I am trying to translate a successful Lotus 1-2-3 spreadsheet into Excel. It > ain't easy! I typed =WORKDAYS and #NAME? popped up. > This is just one...

how would i change default user name all excel files
I am doing a learn direct course and had to use the help facility with question; Find out how you would change the default user name for all excel files. If somebody could help please email me on georginacambridg@aol.com Tools|Options|General Tab and modify the "user name" box learner wrote: > > I am doing a learn direct course and had to use the help facility with > question; > Find out how you would change the default user name for all excel files. > If somebody could help please email me on georginacambridg@aol.com -- Dave Peterson ...