Sub or Function not defined?!

In a further attempt to debug the disabled=false problem, I wrote out some
enabling code in the subforms and call it from the parent. Here is the code
in the subform...

Public Sub UpdateFillsFormState(canEdit)
QuantityField.Enabled = canEdit
PriceField.Enabled = canEdit
TaxField.Enabled = canEdit
NetField.Enabled = canEdit

If Me.RecordsetClone.recordCount > 0 And QuantityField.Enabled = True
Then QuantityField.SetFocus
End Sub

Over in the main form I wait until I know the form is loaded and set up
properly, then I do this...

Public Sub SetupFillState()
canEdit = isEditable()
Call UpdateFillsFormState(canEdit)
End Sub

Access complains that UpdateFillsFormState doesn't exist. Normally this
implies I forgot to set it to public, but as you can see, this is not the
problem. isEditable is definitely returning True.

Any ideas? Is this a "duh"?

Maury 
0
Utf
10/25/2007 6:09:00 PM
access 16762 articles. 3 followers. Follow

3 Replies
1205 Views

Similar Articles

[PageSpeed] 48

In news:D8526E7E-1362-4146-8116-2FCEB5B88750@microsoft.com,
Maury Markowitz <MauryMarkowitz@discussions.microsoft.com> wrote:
> In a further attempt to debug the disabled=false problem, I wrote out
> some enabling code in the subforms and call it from the parent. Here
> is the code in the subform...
>
> Public Sub UpdateFillsFormState(canEdit)
> QuantityField.Enabled = canEdit
> PriceField.Enabled = canEdit
> TaxField.Enabled = canEdit
> NetField.Enabled = canEdit
>
> If Me.RecordsetClone.recordCount > 0 And QuantityField.Enabled = True
> Then QuantityField.SetFocus
> End Sub
>
> Over in the main form I wait until I know the form is loaded and set
> up properly, then I do this...
>
> Public Sub SetupFillState()
> canEdit = isEditable()
> Call UpdateFillsFormState(canEdit)
> End Sub
>
> Access complains that UpdateFillsFormState doesn't exist. Normally
> this implies I forgot to set it to public, but as you can see, this
> is not the problem. isEditable is definitely returning True.
>
> Any ideas? Is this a "duh"?

The Sub may be public, but since it's defined in a class module (the 
subform's module), any call to it must be qualified with a reference to 
the specific class instance.  So, on the main form you'd write something 
like this:

    Call Me.YourSubformControlName.Form.UpdateFillsFormState(canEdit)

In the above, "YourSubformControlName" must be the name of the subform 
control, on the main form, that is displaying the subform.

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


0
Dirk
10/25/2007 6:22:22 PM
Try

 Form_SubFormName.UpdateFillsFormState (True)

Replace SubFormName with the form name

-- 
Good Luck
BS"D


"Maury Markowitz" wrote:

> In a further attempt to debug the disabled=false problem, I wrote out some
> enabling code in the subforms and call it from the parent. Here is the code
> in the subform...
> 
> Public Sub UpdateFillsFormState(canEdit)
> QuantityField.Enabled = canEdit
> PriceField.Enabled = canEdit
> TaxField.Enabled = canEdit
> NetField.Enabled = canEdit
> 
> If Me.RecordsetClone.recordCount > 0 And QuantityField.Enabled = True
> Then QuantityField.SetFocus
> End Sub
> 
> Over in the main form I wait until I know the form is loaded and set up
> properly, then I do this...
> 
> Public Sub SetupFillState()
> canEdit = isEditable()
> Call UpdateFillsFormState(canEdit)
> End Sub
> 
> Access complains that UpdateFillsFormState doesn't exist. Normally this
> implies I forgot to set it to public, but as you can see, this is not the
> problem. isEditable is definitely returning True.
> 
> Any ideas? Is this a "duh"?
> 
> Maury 
0
Utf
10/25/2007 6:27:24 PM
"Dirk Goldgar" wrote:

>     Call Me.YourSubformControlName.Form.UpdateFillsFormState(canEdit)

I had actually tried this, the key was ".Form.". Working like a champ now, 
and the enabling problems disappeared immediately.

Maury
0
Utf
10/25/2007 6:42:02 PM
Reply:

Similar Artilces:

Too many fields defined
I am currently using access 2003 and I am getting a too many fields defined error when attempting to combine 5 sepereate queries into 1. I have tried doing the compact and repair and then rebuild the query that is listed as a suggestion on on other questions and that didn't work. I have listed my SQL information below.. any help would be great. Thanks SELECT [Employee Hierarchy - Current Month].[Performance Year], [Employee Hierarchy - Current Month].[Performance Month], [Employee Hierarchy - Current Month].ATTUID, [Employee Hierarchy - Current Month].Skill, [Employee ...

Duplicating MainForm, SubForm and Sub-SubForm
Hello Everyone, I have an Order Entry Form composed of a MainForm, a SubForm and 2 Sub- Subforms. The SubForm is a continuous form. The two Sub-SubForms are children of a SubForm via a foreign key (which is the Primary Key of a SubForm). There are some instances when customers revised their order by changing just the amount of orders or by just removing one item and the rest are the same. To do this, I would like to keep the initial order (record) and create another record by duplicating the first order then change the amount (or remove an item whatever the case maybe) on the new record. The...

Outlook 2000 Sub folder
Hi I am using outlook 2000 and I have a created a subfolder in my inbox however I am unable to view the folder My Shortcuts on the left hand side of the screen where all my other sub folders are located. In the navigation bar at the top of my pane there is an icon called "move to Folder" and the folder is located here. I am unable to find the location of the folder therefore unable to open the folder or move it to "My shortcuts" I am in need of your expertise. I am ok with computers and can follow instructions so please please please help. Thanking you in ...

Using "Avg" function on calculated field
In a report I have a calculated field as "=Nz([Total],0)/Hrs" which works fine. In the report footer I tried to get the average of the values in this column so I used "=Avg(Nz([Total],0)/Hrs) but when I run it it asks me for the value of "Hrs". Neither "hrs" nor "total" are calculated fields and no error is generated either. The output for the average is just blank. I tried =Avg(Nz([Total],0)/(Nz(Hrs,))) which did not work either. What am I missing? There's a couple of potential issues here. It sounds like Hrs is a field in the table/quer...

how do i reference multiple rows/columns with one function? #2
I am trying to reference multiple rows/columns in one worksheet to summarize in another. Can i do this using one function? Am I able to add rows/columns later to the original sheet without having to update the function on the summary sheet? ...

Automatically control the font of a cell when a function is used
I have a my custom function say myfun(arguments) I would like that whenever I use this function in any cell of a workbook (sheet) there should be always be the same font lets say Times New Roman, the font size to be 10, font color automatic. I tried to make another sub that will check every time the sub is entered and ensure that the cell is well with the desired font type. But, I could not get through the sub. Any help in this regard will be appreciated. Thanks in advance. I don't think that you can make changes to the worksheet from within the UDF but you could use a Workshe...

sub-process
What is the sub-process function in the workflow? How do you set one up? Why would you use it? A sub-process is a way to call a manual rule. If you create a manual rule in workflow called Rule A, in another rule you can insert a sub-process and select the manual rule to run. This is a helpful way to create loops and if/then rules that trigger other events. -- Matt Wittemann http://icu-mscrm.blogspot.com "David M" wrote: > What is the sub-process function in the workflow? > How do you set one up? > Why would you use it? > ...

Sub, Private Sub, Public Sub
I got a different lap top and when I moved my Personal.xls from one to the other some of my macros were not on the list of macros when you go to tools>macros. Although when I look in the code they are there. I figured out that the ones that were "Private Sub" macros were no working. I also figured that when I changed them to just "Sub" they worked. I do know that if "It aint broke don't fix it, cus to try is usually to fix it till it is broke." But what is the difference between "Sub", "Private Sub", & "Public ...

Date functions #4
is there a way to have excel figure out cetain dates for example the last saturday of every month for the next year? http://www.cpearson.com/excel/distribdates.htm Niek Otten "Bonniem" <Bonniem@discussions.microsoft.com> wrote in message news:96880DA0-87B3-4200-9A43-CEB155D3CC33@microsoft.com... > is there a way to have excel figure out cetain dates for example the last > saturday of every month for the next year? > On Mon, 10 Oct 2005 14:49:03 -0700, "Bonniem" <Bonniem@discussions.microsoft.com> wrote: >is there a way to have excel figure...

(Sub)totals
Hello everybody. I have the following problem: I have an Excel file with Column B 'Quantity' and column F 'Sector'. Now i need to count all the quantities within the same sector Sorting + AutoSum isn't an option, since the file has other calculations in it as well, that also depend on a sort. There's in my Dutch version a function 'DBSUM' and a function 'TURNTABEL.FETCH' ... these are translated terms, so I don't know if they match with English versions ... but could someone please tell me how these functions work, since i can't get them right (n...

Use AfxBeginThread for worker thread but use class function
I would like to have a worker thread that executes inside of a function in a class. Is this possible? The AfxBeginThread function gives me compile errors. class foo { void StartThread(void); UINT ThreadProc(LPVOID pvData); } void foo::StartThread(void) { CWinThread* pwt; pwt = AfxBeginThread(this->ThreadProc, NULL); } UINT foo::ThreadProc(LPVOID pvData) { return; } Threads must start in global functions or static functions. Start your thread with a global function and pass a pointer to your object. // Predeclare UINT MyStartUpFunc(LPVOID pParam ); class foo { private: void St...

Consolidate function
A user wants to add the totals of cell M22 from 14 different workbooks into cell A1 of a 15th workbook. What is the best way to do this? He is trying to do a concantonate function, and I do not follow how that works at all. What is the best way to do this? Brenda Do you mean 14 "worksheets" in one workbook or 14 workbooks(files)? If the former enter this in a cell in sheet15. =SUM(Sheet1:Sheet14!M22) Note: Sheet15 must be first or last in order. Gord Dibben Excel MVP On Mon, 12 Jan 2004 14:34:41 -0500, "Brenda Hutton" <bhuttoNOSPAM@michigan.gov> wrote: >...

Problem with user defined messages (WM_APP+n)
Hi, I have a dialog application that creates a modeless child dialog which remains open for the lifetime of the application. This is due to fact child dialog has an activex control that is constantly processing data and cant be shut down. When the user is not using the child dialog i make it invisible and make it visible when they want access to it. Now i found some code that allows the parent dialog to keep track of it's child dialog.This involves adding a modelessdialoghelper and modelessdialogtracker class to my project. (Code at bottom of page) It involves changing the child dialog...

Cascade current view to sub-folders
Hi, Is there any way I can set a custom View setting to a set of folders (e.g. set a view setting for a high-level folder and then have it cascade to all sub-folders)? By a custom View I mean the way that items in a folder shoud look - i.e. font settings and the like. Cheers, Stu ...

A way to create sub-categories?
I want to group contacts by category and then a sub-category for easy viewing. Apart from creating a new field for sub-category is there a way of doing this? Outlook doesn't seem to support sub-categories. Thanks Nope. -- Patricia Cardoza Outlook MVP Author - Special Edition Using Microsoft Office Outlook 2003 Lead Author - Access 2003 VBA Programmer's Reference Author - Absolute Beginner's Guide to Microsoft OneNote 2003 http://blogs.officezealot.com/cardoza http://www.cardozasolutions.com "Casebase" <junkmail@casebase.net> wrote in message news:%23rx5a...

Excel Writeback functionality with SSAS
Hi, I am working on Excel 2010 writeback functionality with SSAS. Writeback functionality works when the cube is of small size. Writeback functionality fails when the cube is of have size say 50lakh records. I get an error as Data cannot be retrieved from external data source. Error Message written by the external data source Server: The operation has been cancelled. ...

Functions for Headers/Footer
Is it possible to enter in "Last printed on" and this sort of function like the ones avaiable in Word. where could I find the VB references for these functions. Thank you --- Message posted from http://www.ExcelForum.com/ You can do this from Page Setup in Excel. If you want VBA, put this in ThisWorkbook Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet .PageSetup.LeftFooter = "Last Printed on: " & Format(Date, "dd mmm yyyy") End With End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Pur...

Can the cell function return "B2" instead of "$B$2"?
Is there a way to get the Cell function to return just the column and row without the "$" signs? =cell("address",maxrate) --> "$B$2" I would like just "B2". hi, ! > Is there a way to get the Cell function to return just the column and row without the "$" signs? > =cell("address",maxrate) --> "$B$2" > I would like just "B2". is this a valid alternate ? =substitute(cell("address",maxrate),"$","") hth, hector. On Sat, 06 Sep 2008 20:33:46 -0700, Square Peg &l...

If Then Function with text
I am not sure if this is possible. I would like to return a value of "consumer," "real estate", or "Visa" dependant on if another cell is equal to B, C, or V. I get the error message ?NAME... so I am not sure if this is the right formula - because the IF/Then needs numberical data or if it is possible! Any ideas? One way: =IF(A1="B","consumer",IF(A1="C","real estate", IF(A1="V","Visa","Other"))) In article <32B4C64A-33D3-4EDF-8A2A-FC59FED204BB@microsoft.com>, "Karen...

Sub or Function not defined?!
In a further attempt to debug the disabled=false problem, I wrote out some enabling code in the subforms and call it from the parent. Here is the code in the subform... Public Sub UpdateFillsFormState(canEdit) QuantityField.Enabled = canEdit PriceField.Enabled = canEdit TaxField.Enabled = canEdit NetField.Enabled = canEdit If Me.RecordsetClone.recordCount > 0 And QuantityField.Enabled = True Then QuantityField.SetFocus End Sub Over in the main form I wait until I know the form is loaded and set up properly, then I do this... Public Sub SetupFillState() canEdit = isEditable() Call Update...

Are sub-totals able to be set to be bold automatically?
I have a large amount of sub-totals, which at the moment are not bold unless I do a manual job of making them so. Is there any way of automating this process in the sub-total procedure? You can use conditional formatting to bold the rows. There are instructions in Excel's Help files, and on the following page: http://www.contextures.com/xlCondFormat01.html Select the columns that contain the table Choose Format>Conditional Formatting From the first dropdown, choose Formula Is In the textbox, enter a formula that refers to a column in which the "Total" text appears...

Array function with more than 29 arguments #2
Hi all, I want to write more than 29 array varibles (defined in a my VBA code) in a workbook range. Is there a way to accomplish this? Here is my sample code (check my remark): Sub ArrayTest() Dim Array1 As Variant Dim Array2 As Variant Dim CompleteArray As Variant Array1 = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) Array2 = Array(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30) CompleteArray = Array(Array1, Array2) Range("A1:AD1").Value = (CompleteArray) 'Result: Range A1 & B2 is empty while the rest is #N/A End Sub ...

Sub error
I have created this macro but everytime I run it the Columns it hides is incorrect. It hides FGHIJK it should only hide GHI. Can anyone tell me why this is happening? Thank you for your help. Sub Done_Changes() ' ' Done_Changes Macro ' ' Range("G11:H50").Select Selection.Locked = True Selection.FormulaHidden = False ActiveWindow.SmallScroll Down:=42 Range("G54:H58").Select Selection.Locked = True Selection.FormulaHidden = False ActiveWindow.SmallScroll Down:=9 Range("G62:H74").Select Selection.Locked = T...

disabling all menu and its sub menus
hi all, how to disable entire menu and its sub menus. i tried the following code it gets the Menu ID but is not disabling the menu items. HMENU hMenu; HWND hwnd = GetSafeHwnd(); hMenu = ::GetMenu(hwnd); int nCount=GetMenuItemCount(hMenu); for (int i=0;i<nCount;i++) { //get the sub menu HMENU hSubMenu=GetSubMenu(hMenu,i); //get the number of items in the submenu and disable them individually. int nSubItems=GetMenuItemCount(hSubMenu); for (int j=0;j<nSubItems;j++) { HMENU hSubMenu=GetSubMenu(hMenu,i);. int nSubItems=GetMenuItemCount(hSubMenu); EnableMenuItem(hSubMenu,G...

Missing Graphing Functionality
In Office 2003, I used to be able to select the following when formating a data series in a graph: fill effects | shadows This would basically give me shadows on the left/rigt sides, etc. This does not appear to be available in Office 2007. Can I still make this selection? Yep. Select the chart. This brings up Chart Tools on the ribbon. Select the Format tab. Then Shape Styles, Shape Effects, Shadow. Everything you had and more, in Excel 2003 is there in Excel 2007 Tyro "dturpin1" <dturpin1@discussions.microsoft.com> wrote in message news:3A3EE875-5C9A-4AA5-A4C5-7BB...