Record Display not refreshed (1 Viewer)

Tupacmoche

Registered User.
Local time
Today, 09:53
Joined
Apr 28, 2008
Messages
291
Hi All,

I have several outstanding issue that, I would like to bring to rest. The first is that this code:

Me.lblRecCnt.Caption = _
"Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount

does not refresh as I use the vba navagation buttons on the form. In order to see the total amt of rows, I first have to go to the last row and then back. Any suggestions on how to fix this?

I have a form that I want to filter on load and have the Combobox filter set to that default. The options are 'All', 'Complete', and 'Incomplete'. This is the code I use : Me.CboIsComplete.Value = Me.CboIsComplete.Selected(0)

Being a zero based control 'All' should be zero (0) but, I get 'Incomplete' the third item in the list showing in the combo box when the form loads. What am I doing wrong? :mad:
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:53
Joined
Oct 29, 2018
Messages
21,477
Hi. For issue #1, where are you using the code? For issue #2, Me.ComboName.Selected(0) is probably not returning what you thought it would return. If you knew you want All, then you could just as simply use Me.ComboName = "All"
 

Tupacmoche

Registered User.
Local time
Today, 09:53
Joined
Apr 28, 2008
Messages
291
For issue #2, I did as you said and changed Me.CboIsComplete.Value = Me.CboIsComplete.Selected(0) to Me.CboIsComplete = "All" and there is no text = All in the combo box. The code is in the onload event of the form.

Issue #1 - The code mentioned above is in the on Current event of the form.:(
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:53
Joined
Oct 29, 2018
Messages
21,477
For Issue #1, try the following code in the Load event of the form:
Code:
DoCmd.GoToRecord, , acLast
DoCmd.GoToRecord, , acFirst
For Issue #2, can you please post the Row Source of your Combobox? Thanks.
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:53
Joined
Sep 21, 2011
Messages
14,320
Put that code in the Current event of the form
 

Tupacmoche

Registered User.
Local time
Today, 09:53
Joined
Apr 28, 2008
Messages
291
Issue #2 row source is a query:
SELECT DISTINCT
tblEgateDone.Description, tblEgateDone.Complete
FROM tblEgateDone;
Please see screen shot.


I added code:
DoCmd.GoToRecord, , acLast DoCmd.GoToRecord, , acFirst
There was not change.
 

Attachments

  • CboIsComplete.JPG
    CboIsComplete.JPG
    13.8 KB · Views: 62

theDBguy

I’m here to help
Staff member
Local time
Today, 06:53
Joined
Oct 29, 2018
Messages
21,477
Hi. Is the Bound Column property of the combo set to 1?
 

Tupacmoche

Registered User.
Local time
Today, 09:53
Joined
Apr 28, 2008
Messages
291
No it was not so now it works. Issue #1 still pending can a label be refreshed.
As in : Me.lblRecCnt.refreshe I don't thing this method is associated with this control. Any other way?:eek:
 

isladogs

MVP / VIP
Local time
Today, 14:53
Joined
Jan 14, 2017
Messages
18,240
No it was not so now it works. Issue #1 still pending can a label be refreshed.
As in : Me.lblRecCnt.refreshe I don't thing this method is associated with this control. Any other way?:eek:

Yes it can but not using a Refresh command as that doesn't apply to labels.
For one approach, see my Student Target Grade Explorer example app

The label showing the total records is updated after each change to the form filters using 2 lines of code
Code:
GetListTotal = rst.RecordCount
and in the Form_Current event
Code:
Me.lblCount.Caption = "Total records = " & GetListTotal

You might also need Me.Requery to refresh the form
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:53
Joined
Sep 21, 2011
Messages
14,320
Ok, Confused here (not hard I admit) but I would like to find out the difference.

I copied your code into the Current event of a form of mine, and added the label.

When I use the record navigation buttons it refreshes on it's own, which is what I was expecting, but wanted to be sure before posting.

So why does it not work for you.?

No it was not so now it works. Issue #1 still pending can a label be refreshed.
As in : Me.lblRecCnt.refreshe I don't thing this method is associated with this control. Any other way?:eek:
 

Users who are viewing this thread

Top Bottom