I want to use a calculated function for the caption on my tab controls. I
used the following code:
Me.Page28.Caption = "Expenses [" & [ExpenseEntryCount] & "]"
This should display the following: " Expenses [10] " where 10 is the number
of expenses on that page. On my form I have a calculated control named
'ExpenseEntryCount' that correctly displayd this information.
If I place this code in the forms OnOpen, OnActivate or OnCurrent event,
when the form is opened the tab reads " Expenses [] " with no number in the
brackets. If however, I place this same code in the onClick event for the
tab control, when I click the blank space to the right of the tabs, the
caption changes from " Expenses [] " to " Expenses [10] ". If I put that
same code in the OnClick event for the actual page, it does not work. What
gives? Am I doing something wrong or am I attempting an impossible feat? 15 2623
Try putting the expression you have for the ExpenseEntryCount into
Me.Page28.Caption. The calculated control seems to be too late.
Jimmy Stewart schreef:
I want to use a calculated function for the caption on my tab controls. I
used the following code:
Me.Page28.Caption = "Expenses [" & [ExpenseEntryCount] & "]"
--
Bas Cost Budde
Holland
I'm not sure I understand what your saying. I have tried to put that code in
the OnOpen event of the form and the caption text is correct but the
calculation is not made.
"Bas Cost Budde" <b.*********@dev.null.comwrote in message
news:ef**********@localhost.localdomain...
Try putting the expression you have for the ExpenseEntryCount into
Me.Page28.Caption. The calculated control seems to be too late.
Jimmy Stewart schreef:
>I want to use a calculated function for the caption on my tab controls. I used the following code:
Me.Page28.Caption = "Expenses [" & [ExpenseEntryCount] & "]"
Jimmy Stewart wrote:
I'm not sure I understand what your saying. I have tried to put that
code in the OnOpen event of the form and the caption text is correct
but the calculation is not made.
Have you tried the Current event?
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
I think this is one of those things where the calculated control on screen
ambles along a little while after the form has initialised or been
recalculated.
The method I've used in the past, that you might consider trying is as
follows:
With Me.Recordsetclone
If Not .EOF Then
.MoveLast
End If
Me.Page28.Caption = "Expenses [" & CStr(.RecordCount) & "]"
End With
Jimmy Stewart wrote:
>I want to use a calculated function for the caption on my tab controls. I used the following code:
Me.Page28.Caption = "Expenses [" & [ExpenseEntryCount] & "]"
This should display the following: " Expenses [10] " where 10 is the number of expenses on that page. On my form I have a calculated control named 'ExpenseEntryCount' that correctly displayd this information.
If I place this code in the forms OnOpen, OnActivate or OnCurrent event, when the form is opened the tab reads " Expenses [] " with no number in the brackets. If however, I place this same code in the onClick event for the tab control, when I click the blank space to the right of the tabs, the caption changes from " Expenses [] " to " Expenses [10] ". If I put that same code in the OnClick event for the actual page, it does not work. What gives? Am I doing something wrong or am I attempting an impossible feat?
--
Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200609/1
From my original post:
"If I place this code in the forms OnOpen, OnActivate or OnCurrent event,
when the form is opened the tab reads " Expenses [] " with no number in the
brackets."
"Rick Brandt" <ri*********@hotmail.comwrote in message
news:4k******************@newssvr11.news.prodigy.c om...
Jimmy Stewart wrote:
>I'm not sure I understand what your saying. I have tried to put that code in the OnOpen event of the form and the caption text is correct but the calculation is not made.
Have you tried the Current event?
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
What exactly is that code doing? I placed it in the onopen event of the form
and got some very wrong numbers between the brackets.
"RichardP via AccessMonster.com" <u26938@uwewrote in message
news:66f6bab16d49e@uwe...
>I think this is one of those things where the calculated control on screen
ambles along a little while after the form has initialised or been
recalculated.
The method I've used in the past, that you might consider trying is as
follows:
With Me.Recordsetclone
If Not .EOF Then
.MoveLast
End If
Me.Page28.Caption = "Expenses [" & CStr(.RecordCount) & "]"
End With
Jimmy Stewart wrote:
>>I want to use a calculated function for the caption on my tab controls. I used the following code:
Me.Page28.Caption = "Expenses [" & [ExpenseEntryCount] & "]"
This should display the following: " Expenses [10] " where 10 is the number of expenses on that page. On my form I have a calculated control named 'ExpenseEntryCount' that correctly displayd this information.
If I place this code in the forms OnOpen, OnActivate or OnCurrent event, when the form is opened the tab reads " Expenses [] " with no number in the brackets. If however, I place this same code in the onClick event for the tab control, when I click the blank space to the right of the tabs, the caption changes from " Expenses [] " to " Expenses [10] ". If I put that same code in the OnClick event for the actual page, it does not work. What gives? Am I doing something wrong or am I attempting an impossible feat?
--
Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200609/1
What is the ControlSource property of the ExpenseEntryCount control now?
I guess it is some expression starting with "="; you have to put that
expression, without the "=", in place of the & [ExpenseEntryCount] &
part of the Caption property's controlsource.
Jimmy Stewart schreef:
I'm not sure I understand what your saying. I have tried to put that code in
the OnOpen event of the form and the caption text is correct but the
calculation is not made.
"Bas Cost Budde" <b.*********@dev.null.comwrote in message
news:ef**********@localhost.localdomain...
>Try putting the expression you have for the ExpenseEntryCount into Me.Page28.Caption. The calculated control seems to be too late.
Jimmy Stewart schreef:
>>I want to use a calculated function for the caption on my tab controls. I used the following code:
Me.Page28.Caption = "Expenses [" & [ExpenseEntryCount] & "]"
--
Bas Cost Budde
Holland www.heuveltop.nl/BasCB/msac_index.html
The code is taking a copy of the recordset source for your current form,
moving to the end of the recordset to ensure that the recordcount is accurate,
and then displaying the result of the recordcount in your caption.
However, this is making an assumption that the recordcount you wish to
display is the one of your main form. If the recordcount required is the one
of a subform embedded in your one of your tab pages, you would need to adapt
accordingly, e.g.
With Me.frmPage28subform.Recordsetclone
<same code as before>
End With
Off the top of my head (and reading between the lines of what you're saying
you're doing), I would probably put this into its own public procedure - e.g.
"RefreshTabCaptions". Then in the Form_Current event of the subform itself, I
would insert a line of code such as "Call Parent.RefreshTabCaptions".
You've not said what the expression is in your calculated control which
determines the record count, so I've no way of estimating why you've received
'very wrong' numbers.
Jimmy Stewart wrote:
>What exactly is that code doing? I placed it in the onopen event of the form and got some very wrong numbers between the brackets.
>>I think this is one of those things where the calculated control on screen ambles along a little while after the form has initialised or been
[quoted text clipped - 29 lines]
>>>What gives? Am I doing something wrong or am I attempting an impossible feat?
--
Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200609/1
Well, thats a bit complicated. On the relevent page there is a subform
frmPWExpensesSubform. On this subform is a calculated control named
TotalEntries to count the number of records... =Count([Description]). Then
on the main form I have a control named ExpenseEntryCount that simply
references that control... =[frmPWExpensesSubform]![TotalEntries]. If I put
either [ExpenseEntryCount] or [frmPWExpensesSubform]![TotalEntries] in the
event statement ... Me.Page28.Caption = "Expenses [" & [controlname] & "]" I
get the same problem, text but no calculation.
"Bas Cost Budde" <b.*********@dev.null.comwrote in message
news:ef**********@localhost.localdomain...
What is the ControlSource property of the ExpenseEntryCount control now? I
guess it is some expression starting with "="; you have to put that
expression, without the "=", in place of the & [ExpenseEntryCount] & part
of the Caption property's controlsource.
Jimmy Stewart schreef:
>I'm not sure I understand what your saying. I have tried to put that code in the OnOpen event of the form and the caption text is correct but the calculation is not made.
"Bas Cost Budde" <b.*********@dev.null.comwrote in message news:ef**********@localhost.localdomain...
>>Try putting the expression you have for the ExpenseEntryCount into Me.Page28.Caption. The calculated control seems to be too late.
Jimmy Stewart schreef: I want to use a calculated function for the caption on my tab controls. I used the following code:
Me.Page28.Caption = "Expenses [" & [ExpenseEntryCount] & "]"
--
Bas Cost Budde
Holland www.heuveltop.nl/BasCB/msac_index.html
However, this is making an assumption that the recordcount you wish to
display is the one of your main form. If the recordcount required is the
one
of a subform embedded in your one of your tab pages, you would need to
adapt
accordingly, e.g.
With Me.frmPage28subform.Recordsetclone
<same code as before>
End With
Tried this...
Private Sub Form_Open(Cancel As Integer)
With Me.frmPWExpensesSubform.RecordsetClone
If Not .EOF Then
.MoveLast
End If
Me.Page28.Caption = "Expenses [" & CStr(.RecordCount) & "]"
End With
but no can do, Access doesn't like that...
>
Off the top of my head (and reading between the lines of what you're
saying
you're doing), I would probably put this into its own public procedure -
e.g.
"RefreshTabCaptions". Then in the Form_Current event of the subform
itself, I
would insert a line of code such as "Call Parent.RefreshTabCaptions".
Tried this also but access says there is an invalid reference to the parent
property. I've never used a public function before so I may be doing
something wrong that is easily correctable!?
Public Sub RefreshTabCaptions()
With Me.frmPWExpensesSubform.RecordsetClone
If Not .EOF Then
.MoveLast
End If
Me.Page28.Caption = "Expenses [" & CStr(.RecordCount) & "]"
End With
End Sub
Private Sub Form_Open(Cancel As Integer)
Call Parent.RefreshTabCaptions
End Sub
You've not said what the expression is in your calculated control which
determines the record count, so I've no way of estimating why you've
received
'very wrong' numbers.
From posting in this same thread following a different line of thinking...
"Well, thats a bit complicated. On the relevent page there is a subform
frmPWExpensesSubform. On this subform is a calculated control named
TotalEntries to count the number of records... =Count([Description]). Then
on the main form I have a control named ExpenseEntryCount that simply
references that control... =[frmPWExpensesSubform]![TotalEntries]. If I put
either [ExpenseEntryCount] or [frmPWExpensesSubform]![TotalEntries] in the
event statement ... Me.Page28.Caption = "Expenses [" & [controlname] & "]" I
get the same problem, text but no calculation."
On Fri, 29 Sep 2006 01:02:47 GMT, "Jimmy Stewart" <no**@none.comwrote:
>
>However, this is making an assumption that the recordcount you wish to display is the one of your main form. If the recordcount required is the one of a subform embedded in your one of your tab pages, you would need to adapt accordingly, e.g.
With Me.frmPage28subform.Recordsetclone <same code as before> End With
Tried this... Private Sub Form_Open(Cancel As Integer)
With Me.frmPWExpensesSubform.RecordsetClone
If Not .EOF Then
.MoveLast
End If
Me.Page28.Caption = "Expenses [" & CStr(.RecordCount) & "]"
End With
but no can do, Access doesn't like that...
You are not referencing the subform correctly, you are referencing the subform
control, NOT the subform contained within the control. You need to add .Form.
before the RecordsetClone -
With Me.frmPWExpensesSubform.Form.RecordsetClone
If Not .EOF Then
.MoveLast
End If
Me.Page28.Caption = "Expenses [" & CStr(.RecordCount) & "]"
End With
I would try this code on the Form_Load event as the subform data may not have
been loaded fully when the Form_Open event fires.
Wayne Gillespie
Gosford NSW Australia
maybe frmPWExpensesSubform.Form.recordsetclone.recordcou nt then?
Jimmy Stewart schreef:
Well, thats a bit complicated. On the relevent page there is a subform
frmPWExpensesSubform. On this subform is a calculated control named
TotalEntries to count the number of records... =Count([Description]). Then
on the main form I have a control named ExpenseEntryCount that simply
references that control... =[frmPWExpensesSubform]![TotalEntries]. If I put
either [ExpenseEntryCount] or [frmPWExpensesSubform]![TotalEntries] in the
event statement ... Me.Page28.Caption = "Expenses [" & [controlname] & "]" I
get the same problem, text but no calculation.
--
Bas Cost Budde
Holland www.heuveltop.nl/BasCB/msac_index.html
Jimmy Stewart wrote:
I want to use a calculated function for the caption on my tab controls. I
used the following code:
Me.Page28.Caption = "Expenses [" & [ExpenseEntryCount] & "]"
This should display the following: " Expenses [10] " where 10 is the number
of expenses on that page. On my form I have a calculated control named
'ExpenseEntryCount' that correctly displayd this information.
If I place this code in the forms OnOpen, OnActivate or OnCurrent event,
when the form is opened the tab reads " Expenses [] " with no number in the
brackets. If however, I place this same code in the onClick event for the
tab control, when I click the blank space to the right of the tabs, the
caption changes from " Expenses [] " to " Expenses [10] ". If I put that
same code in the OnClick event for the actual page, it does not work. What
gives? Am I doing something wrong or am I attempting an impossible feat?
Suggestion: Try using DCount instead of a separate calculated
control. Should solve your problem.
Thanks for that Wayne, yes apologies for leading you astray there - I was
typing untested code directly into this message and neglected to include the
".Form" property - will try to re-read before posting in future!
Wayne Gillespie wrote:
>>However, this is making an assumption that the recordcount you wish to display is the one of your main form. If the recordcount required is the
[quoted text clipped - 17 lines]
>> but no can do, Access doesn't like that...
You are not referencing the subform correctly, you are referencing the subform control, NOT the subform contained within the control. You need to add .Form. before the RecordsetClone -
With Me.frmPWExpensesSubform.Form.RecordsetClone
If Not .EOF Then
.MoveLast
End If
Me.Page28.Caption = "Expenses [" & CStr(.RecordCount) & "]" End With
I would try this code on the Form_Load event as the subform data may not have been loaded fully when the Form_Open event fires.
Wayne Gillespie Gosford NSW Australia
--
Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200609/1 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jeremy Weiss |
last post by:
I've got a temp table that contains the fields: amountowed, amountpaid, and
balanced. I've got a form that shows this information and I've set it up so
that when the amountpaid field is changed it...
|
by: Paul T. Rong |
last post by:
Hello,
Often when I open one form, and (without closing it) open the form in its
design view, then all the caption value of the controls in this form
remained there in form's design view that is...
|
by: altacct |
last post by:
I've got a multi-page subform with a tab control on one of the pages.
The code that moves you from page three to page four, which is where
the tab is, changes the tab captions according to some...
|
by: Tony Williams |
last post by:
I have a form with a tabcontrol which has a number of pages. I want to check
the value of a calculated control on one page with a calculated control on
another page. The calculated control...
|
by: MLH |
last post by:
This is one for you gurus. Someone has undoubtedly already done this.
How difficult would it be to recurse all command buttons and textbox
controls on all forms, appending an incrementing number to...
|
by: kelley.l.turner |
last post by:
Hi all,
I am very new to MS Access so please bear with me! I have created a
simple calculated field in my data entry form, yet when I view my data
table or try to generate a report based on...
|
by: Franky |
last post by:
I have a MDI form open and two child forms open in it.
Each of the children contains a usercontrol which contains a richtextbox.
The topmost form's caption bar is highlighted but I click on the...
|
by: jcf378 |
last post by:
hi all.
I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ).
However, when I click "Filter by...
|
by: DavidB |
last post by:
I want to be able to find the value of the Caption property of a Page
in my Tab Control based solely on the Page Index property value. Is
this possible?
Example...
tcBedrock
pFred - Page...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |