I have a subform that shows images (0, 1, 2, ...etc) linked to a main form. I would like to display the current record number of total number of records for each linked record on the main form. (ie "Image" X " of " Y).
My problem is that as I move between records on my main form, the record information on the subform does not change. I set the subform to NOT show the navigation button (I put command buttons on the form with that functionality). I have tried:
Initially:
lblRecords.capt ion = 1 'increment by +1 or -1 if me.recordset.mo venext or moveprevious
lblTotalRecords .caption = me.recordset.re cordcount
The values get really messed up as I navigate through the sub-form and main form. I am very frustrated because I thought this would be simple.
I am a VBA neophyte, so please use small words. :-)
Thanks in Advance
2 18649
I have a subform that shows images (0, 1, 2, ...etc) linked to a main form. I would like to display the current record number of total number of records for each linked record on the main form. (ie "Image" X " of " Y).
My problem is that as I move between records on my main form, the record information on the subform does not change. I set the subform to NOT show the navigation button (I put command buttons on the form with that functionality). I have tried:
Initially:
lblRecords.capt ion = 1 'increment by +1 or -1 if me.recordset.mo venext or moveprevious
lblTotalRecords .caption = me.recordset.re cordcount
The values get really messed up as I navigate through the sub-form and main form. I am very frustrated because I thought this would be simple.
I am a VBA neophyte, so please use small words. :-)
Thanks in Advance
If I understood you correctly, you want the counts for your subform records while moving thru different records on the main form. Try this in the Current event of your main form. You have to replace illustrative object names like YourSubformCont rol with their actual names in your application. I am also assuming your label captions are on the main form. If these assumptions are not correct, the code will have to change accordingly: -
Me.YourSubformControl.RecordsetClone.movelast
-
Me.lblRecords.caption = Me.YourSubformControl.CurrentRecord
-
Me.lblTotalRecords.caption = Me.YourSubformControl.RecordsetClone.RecordCount
If the above does not work,place a textbox named txtRecordIndica tor in the desired location on your main form, and place this code on your Form_Current() event for your main form. -
Me.YourSubformControl.RecordsetClone.movelast
-
Me.txtRecordIndicator.Value = Me.YourSubformControl.CurrentRecord & _
-
" of " & Me.YourSubformControl.RecordsetClone.RecordCount
Hah! Perfect and so much simpler than my attempted solutions (plus it works). I actually wanted the count and total records information to be on the sub-form, not the main form. Changing the code was an easy fix.
me.RecordsetClo ne.movelast
Me.lblRecords.c aption = Me.CurrentRecor d
Me.lblTotalReco rds.caption = Me.RecordsetClo ne.RecordCount
Thank you!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: deko |
last post by:
I have a form with a subform datasheet - I need code behind the OnDelete
event of the subform:
Private Sub Form_Delete(Cancel As Integer)
'do something that depends on which record is deleted
End Sub
This works okay when only one record is selected and the delete key is
pressed (or right-click delete is selected - makes no difference). But if
multiple records are selected in the datasheet, the code runs for the first
|
by: Matt K. |
last post by:
Hi there,
I have a form in an Access project that contains a subform which
displays the results of a query of the style "select * from
where = #a certain date#". In the main part of the form
the user can change the date, which will force a requery in the
subform to bring up records from the date selected.
My question is this... The query in the subform is a very simple one,
with only three fields being returned. In the interest of...
|
by: Lauren Quantrell |
last post by:
I'm using SQL Server backend on an Access 2K front end.
I populate a subform:
Forms!myForm.myChild.Form.RecordSource = "myStoredProcedureName"
On that form is a control where the controlsource is "=
Count()"
that shows the user the number of records.
What I'm doing now is populating the subform, using the
RecordsetClone.RecordCount of the subform to determine if any records
were returned, and if not, opening a message box telling the...
|
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 number changes
fine. Within this main form I have a subform detailing distribution
records for the contact (main form is based on this) that also has
navigation buttons and a label showing Distribution 1 of ##. This is
where the problem lies. The...
|
by: misscrf |
last post by:
On a main form, there is a subform. I want to make a field that will
show how many records there are within that subform. Count on the pk,
where the subform's fk = the main form pk.. or something like that.
I have this, but not getting it right.. keep getting #name
=DCount(tblApplications!AppID,,tblApplications!CandID=Forms!frmCandidateEntry!anCandID)
any thoughts?
Thanks.
| |
by: phaddock4 |
last post by:
Being fairly inexperienced at Access 2000, i've been reading many posts
here for the last several days, and testing myself to find the best
approach to do the following in A2K:
SET UP:
I have created a MainTable (and related form), which has an associated
SubForm (popup) along with its underlying, separate Table.
The tables' relationship is one to many respectively. The primary key
|
by: sparks |
last post by:
I am trying to fix a database that someone did about 4 yrs ago in
access97.
The main table just contains demographics and is on the main form of
the database.
It has a subform on a tab that contains the other information.
it is set 1 to 1 in the relationships.
simplify if I can
|
by: Beany |
last post by:
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...
|
by: jwbird |
last post by:
I have a main form with multiple Subforms that are all displaying Datasheet information related to the Main form record. When I make changes/adds to the records(s) in the subform and tab to another subform, it saves those previous subform records fine, but when I make changes to the subform records and then change the mainform criteria, it doesn't save those subform records.
I can use an event to prompt for saving the records on the...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |