Hi,
Can some please provide me with the code for counting records in a subform and displaying it in a textbox?
Does this code go into the control source of the textbox?
My subform is called 'Asset subform' within the form 'Form1'.. the textbox will be in the same form.
Also im showing records in a subform by selecting a user from a combobox...
How can i input a users name in a textbox once i have selected him from the combobox?
All help will be appreciated
11 9443
Hi,
Can some please provide me with the code for counting records in a subform and displaying it in a textbox?
Does this code go into the control source of the textbox?
My subform is called 'Asset subform' within the form 'Form1'.. the textbox will be in the same form.
Also im showing records in a subform by selecting a user from a combobox...
How can i input a users name in a textbox once i have selected him from the combobox?
All help will be appreciated
In the Control Source of the Text Box on Form1, place the following code: - =DCount("*","<Record Source for Sub-Form>","[<Linking Field>]=" & Forms!Form1![<Primary Key>])
In the Control Source of the Text Box on Form1, place the following code: - =DCount("*","<Record Source for Sub-Form>","[<Linking Field>]=" & Forms!Form1![<Primary Key>])
for some reason im getting an error : Error?
ive inserted the following code:
=DCount("*","<Asset subform>","[<Text16>]=" & Forms!Form1![<ID>])
Am i doing something obviously wrong?
My subform is called: Asset subform
My Form is called: Form1
TextBox is called: Text16
and the primary key for my main table is 'ID'...
im confused???
First off, drop the < and > ! When used in example code, whether here or in text books, <Things Like This> takes the place of an object name, so if your Primary Key is named ID, [<Primary Key>]
would become [ID]
when you actually write your code.
Linq ;0)>
Hi,
thanks for reply,
ive tried that, got rid of the <>
but im still getting an error??
Hi,
thanks for reply,
ive tried that, got rid of the <>
but im still getting an error??
Replace Asset subform with the Name of the Record Source for the Sub-Form via Select Asset subform ==> Properties ==> Data Tab ==> Record Source.
Thank you for the replies..
the record source for my subform is: - SELECT Asset.ID, Asset.Asset, Asset.[Product Type], Asset.Manufacturer, Asset.Description, Asset.[Model No], Asset.[Serial No], Asset.[Windows Key], Asset.User, Asset.Department, Asset.Location, Asset.[Comms Date], Asset.Returned, Asset.[Return Reason] FROM Asset WHERE (((Asset.User) Like Forms!AssetMain!Combo2));
so ive got the following: - =DCount("*","SELECT Asset.ID, Asset.Asset, Asset.[Product Type], Asset.Manufacturer, Asset.Description, Asset.[Model No], Asset.[Serial No], Asset.[Windows Key], Asset.User, Asset.Department, Asset.Location, Asset.[Comms Date], Asset.Returned, Asset.[Return Reason] FROM Asset WHERE (((Asset.User) Like Forms!AssetMain!Combo2))","[Text16]=" & [Forms]![Form1]![ID])
But im still seeing an error?? y?
thanks
Thank you for the replies..
the record source for my subform is: - SELECT Asset.ID, Asset.Asset, Asset.[Product Type], Asset.Manufacturer, Asset.Description, Asset.[Model No], Asset.[Serial No], Asset.[Windows Key], Asset.User, Asset.Department, Asset.Location, Asset.[Comms Date], Asset.Returned, Asset.[Return Reason] FROM Asset WHERE (((Asset.User) Like Forms!AssetMain!Combo2));
so ive got the following: - =DCount("*","SELECT Asset.ID, Asset.Asset, Asset.[Product Type], Asset.Manufacturer, Asset.Description, Asset.[Model No], Asset.[Serial No], Asset.[Windows Key], Asset.User, Asset.Department, Asset.Location, Asset.[Comms Date], Asset.Returned, Asset.[Return Reason] FROM Asset WHERE (((Asset.User) Like Forms!AssetMain!Combo2))","[Text16]=" & [Forms]![Form1]![ID])
But im still seeing an error?? y?
thanks
You must use a Table name or Query for the 2nd Argument for the DCount() Function as in: - DCount("*", "<Table Name>")
-
DCount("*", "<Query Name>")
You must use a Table name or Query for the 2nd Argument for the DCount() Function as in: - DCount("*", "<Table Name>")
-
DCount("*", "<Query Name>")
honestly im confused now, why two Dcounts?
thanks
excellent,
thank you for your patience...
it counts the records now.... it counts the users in the table 'Asset'.
Im selecting a user from a combobox, and then displaying the records for this user in the subform. how can i get it to count records in the subform?
anyone?
any help will be appreciated..
thanks
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Rey |
last post by:
Howdy all.
Appreciate your help with several problems I'm having:
I'm trying to determine if the Visit subform (subformVisits) has a new
record or been changed, i.e. dirty. The form that...
|
by: PeteCresswell |
last post by:
I'm looking for some code that makes a list presented in a subform
autoscroll in response to the user typing - like a combo box dropdown
or a regular ListBox does.
I.e. The user is looking at...
|
by: Carl |
last post by:
I have a main form with navigation buttons on it and a label showing
for example Record 1 of 15 using recordsetclone on it and eveything
works fine. When I move through the records the record...
|
by: CSDunn |
last post by:
Hello,
In an Access 2003 ADP Subform, I am trying to set the BackGround color
of three textbox fields (LSScore, RScore, WScore) in the current
record of the subform to zero (black) if the value of...
|
by: Simon P |
last post by:
Hello group, I'm in desperate need of help. Here goes :
I have the following tables : CONTACTS (ContactID, FirstName,
LastName, Company, etc.), SHOWS (ShowID, ShowDescription) and
SHOWDETAILS...
|
by: Joshua Ammann |
last post by:
Hi,
(Using Access 2000)
I have two tables, similar to Customers and Orders. (Not an exact
parallel, but works for this example.)
On a form showing customer data, there is a tab control. One...
|
by: Lyn |
last post by:
Hi,
I have a form which contains a number of subforms in different pages of a
tab control. In the detail section of each subform, I list records related
to the main form record, but from...
|
by: matthewemiclea |
last post by:
So I think this may be a stretch, but I have a subform that is
displayed on a main form. The subform is based on a query that brings
records from a table(It does not bring all fields, but the main...
|
by: bitsnbytes64 |
last post by:
Hi,
I have a form which contains a subform. Both are were creetd using the form wizard and are bound by the column IXO_NR (on two different tables), which is the control source for a textbox on...
|
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...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
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...
|
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)...
|
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: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
| |