473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

calculated form

Friends, I have a table with a field named Initials which has its
record source to another table named Initials.
I would like to add on a form named Welcome two controls:
A combo box, which displays the initials of all my database users and
a text box which calculated the number of records associated to the
selected user.

I would like to use the OnChange event of the combo to run the query
or the calculation code.

Is there a way I can do this?

Thanks.
Nov 13 '05 #1
2 2004
Add the combo box to the form. Set its Row Source to a query that returns
the initials from the table that lists the initials. The wording in your
first sentence is confusing. Is the Initials field the field that the two
tables are joined on? Is the table that lists the initials also called
initials?

Example:
SELECT [Initials].[Initials] FROM [Initials] ORDER BY [Initials]

Then add the textbox. Set the Control Source of the textbox to

=DCount("*", "[NameOfOtherTable]", "[Initials]='" & cboNameOfCombo & "'")

This will make the textbox a calculated control. You shouldn't need a VBA
event to do this.

--
Wayne Morgan
Microsoft Access MVP
"Paolo" <jp***@tin.it> wrote in message
news:9f**************************@posting.google.c om...
Friends, I have a table with a field named Initials which has its
record source to another table named Initials.
I would like to add on a form named Welcome two controls:
A combo box, which displays the initials of all my database users and
a text box which calculated the number of records associated to the
selected user.

I would like to use the OnChange event of the combo to run the query
or the calculation code.

Is there a way I can do this?

Thanks.

Nov 13 '05 #2
One other way would be to use a totals query for the source of your combo.
In the query add the Initials field twice to the control grid. Under the
first set it to GroupBy under the second set it to Count. Now set the
control source of you unbound text box on your form to:
=([MyCombo].Column(1))

--
Reggie

----------
"Wayne Morgan" <co***************************@hotmail.com> wrote in message
news:fy***************@newssvr17.news.prodigy.com. ..
Add the combo box to the form. Set its Row Source to a query that returns
the initials from the table that lists the initials. The wording in your
first sentence is confusing. Is the Initials field the field that the two
tables are joined on? Is the table that lists the initials also called
initials?

Example:
SELECT [Initials].[Initials] FROM [Initials] ORDER BY [Initials]

Then add the textbox. Set the Control Source of the textbox to

=DCount("*", "[NameOfOtherTable]", "[Initials]='" & cboNameOfCombo & "'")

This will make the textbox a calculated control. You shouldn't need a VBA
event to do this.

--
Wayne Morgan
Microsoft Access MVP
"Paolo" <jp***@tin.it> wrote in message
news:9f**************************@posting.google.c om...
Friends, I have a table with a field named Initials which has its
record source to another table named Initials.
I would like to add on a form named Welcome two controls:
A combo box, which displays the initials of all my database users and
a text box which calculated the number of records associated to the
selected user.

I would like to use the OnChange event of the combo to run the query
or the calculation code.

Is there a way I can do this?

Thanks.


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Anonymous | last post by:
Hi all, I have a form people use to enter checking data. One of the fields is calculated based on finding the difference of two input fields on the form. Here are the fields: CheckAmount...
0
by: Henry | last post by:
Hi Is there any good ideas how to update form vb code always after some values are changed / added by vb (not user). I have some code behind subforms vb and there are calculations behind...
1
by: Miguelito Bain | last post by:
hi everybody. i'm trying to find out what you can and can't do with/in calculated fields. any help, pointers, and/or advice would be greatly appreciated. i'm a newbie, but i want to learn, and...
1
by: douh | last post by:
I know that this is not the way, however I need to save certian calculated values so that they do not change over time, ie. new tax rates etc. This is for an invoice header and invoice subform. I...
1
by: Norbert Lieckfeldt | last post by:
MS Access 2002 here. I am just trying to set up a simple database for a friend who's an optician. Basically, all clients with address details, date of last eyetest and a drop-down combo box to...
2
by: david | last post by:
Hi, I have a form with a couple of calculated fields. I want to put some code into the 'Form-Load' event to set various object states on the form, depending on the value of these fields. The...
1
by: tconway | last post by:
I have an Access program that displays Customer data into a form and OrderID data into a subform. The totals in the Subform are based on calculated fields, i.e. the Total Amount field Calculates...
3
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...
2
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...
9
by: Haas C | last post by:
Hi all! Is there anyway I can override a value in a calculated field on a form? For example: I have a form which displays the following fields based on a query: Premium Due field has the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.