473,406 Members | 2,816 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,406 software developers and data experts.

Count IF on MS Access

7
How do you create a field on a form that counts the selected records, only if a certain word is in the field.

Records are selected via a combo box on a form header.
I then have tabs below that display different subforms.(One of the tabs is orders)

Basically i have combo box on the orders form that lists all posible locations for a particular item e.g.
"location 1 - sub location 1"
"location 1 - sub location 2"
"location 2 - sub location 1"
"location 2 - sub location 2"

i want to count all the records that have "location 1" at the start and display the quantity in a field on the orders form
Feb 11 '08 #1
5 4798
ADezii
8,834 Expert 8TB
How do you create a field on a form that counts the selected records, only if a certain word is in the field.

Records are selected via a combo box on a form header.
I then have tabs below that display different subforms.(One of the tabs is orders)

Basically i have combo box on the orders form that lists all posible locations for a particular item e.g.
"location 1 - sub location 1"
"location 1 - sub location 2"
"location 2 - sub location 1"
"location 2 - sub location 2"

i want to count all the records that have "location 1" at the start and display the quantity in a field on the orders form
This would be the general idea:
Expand|Select|Wrap|Line Numbers
  1. Me![txtQuantity] = DCount("*", "<Your Table Name>", "Left([<Location Field>], 10) = 'Location 1'")
Feb 12 '08 #2
Nasher
7
This would be the general idea:
Expand|Select|Wrap|Line Numbers
  1. Me![txtQuantity] = DCount("*", "<Your Table Name>", "Left([<Location Field>], 10) = 'Location 1'")
Cheers for the quick response ADezii.

I've been trying to get that code to work but unfortunatly i'm not very good when it comes to visual basic and i haven't been successful yet.

Can you give me step by step instructions, or is their another way of doing it e.g. expression builder or a query

P.S. forgive me if i sound stupid, but i am!
Feb 12 '08 #3
ADezii
8,834 Expert 8TB
Cheers for the quick response ADezii.

I've been trying to get that code to work but unfortunatly i'm not very good when it comes to visual basic and i haven't been successful yet.

Can you give me step by step instructions, or is their another way of doing it e.g. expression builder or a query

P.S. forgive me if i sound stupid, but i am!
I'll need your Table Name, Location Field Name in the Table, and the Location Field Name on the Form, and the Quantity Field Name.
Feb 12 '08 #4
Nasher
7
I'll need your Table Name, Location Field Name in the Table, and the Location Field Name on the Form, and the Quantity Field Name.
Table name is "Scaling", field name in the table is "Location Name", field name on the form is "Location Name" and the quantity field name is "Quantity"

Cheers for the help ADezii
Feb 13 '08 #5
ADezii
8,834 Expert 8TB
Table name is "Scaling", field name in the table is "Location Name", field name on the form is "Location Name" and the quantity field name is "Quantity"

Cheers for the help ADezii
Try:
Expand|Select|Wrap|Line Numbers
  1. Me![Quantity] = DCount("*", "Scaling", "Left([Location Name], 10) = '" & Me![Location Name] & "'")
Feb 13 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: thomasp | last post by:
I am trying to get a record count of a PHP query on a MS Acess database using ODBC with a DSN for MS ACCESS connection. I got this code from the PHP manual user notes. It seems to return the...
5
by: Cro | last post by:
Hello Access Developers, I'd like to know if it is possible to perform a count in an expression that defines a control source. My report is based on a query. In my report, I want a text box to...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
2
by: Volkan | last post by:
Hi, I'm trying to compare two XML documents and i'm using XPath queries to select nodes. XPathNavigator's Select method runs fast enough and returns an XPathNodeIterator object. When i try to...
1
by: heckstein | last post by:
I am working in Access 2002 and trying to create a report from our company's learming management system. I am not a DBA and most of my SQL knowledge has been self taught through trial and error. I...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
10
by: Phil Stanton | last post by:
I am trying to count the fields in a queryDef in an external database. If I run this in the actaal database I get Fields.count = 6 correctly Private Sub ObjectName_DblClick(Cancel As Integer) ...
7
by: CampbellJD1 | last post by:
I am using Access 2003 Professional. I have been working with Access for some time and I have created an MDB with a Linked Table and the Data there is temporarily transferred to other Table for...
3
by: wildThought | last post by:
If I have an object that contains a generic dictionary inside of it, how do I get access to its properties such as count?
13
by: craigchalmers | last post by:
Hi I am a complete novice so hope someone can shed some light on my problem/goal. I have an access database with some records in it. i have two fields 1) ArrivalDate 2) ReturnDate
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.