From: gagecres on 5 Mar 2010 08:55 Here is the code I am using: With Me.RecordsetClone .MoveLast Me.txt_Rec_Count.Value = Me.CurrentRecord & " of " & .RecordCount & " line(s)" End With Also, I commented out the OnLoad lines "Gina Whipp" wrote: > Please post the exactly the code you are using here... And if you have no > reason for the DoCmd.GoToRecord lines, remove them from the On_Load event. > > -- > Gina Whipp > 2010 Microsoft MVP (Access) > > "I feel I have been denied critical, need to know, information!" - Tremors > II > > http://www.regina-whipp.com/index_files/TipList.htm > > "gagecres" <gagecres(a)discussions.microsoft.com> wrote in message > news:3843298D-90EB-473F-A75D-58E961D9AE0A(a)microsoft.com... > I still get an error saying: "No current record." When I debug it, it > highlights ".MoveLast". > > "Gina Whipp" wrote: > > > gagecres, > > > > I use on the On_Current event of the form... > > > > With Me.RecordsetClone > > .MoveLast > > Me.txtPage = Me.CurrentRecord & " of " & .RecordCount & " > > line(s)" > > End With > > > > Make sure to place a text box on your form names... *txtPage* > > -- > > Gina Whipp > > 2010 Microsoft MVP (Access) > > > > "I feel I have been denied critical, need to know, information!" - Tremors > > II > > > > http://www.regina-whipp.com/index_files/TipList.htm > > > > "gagecres" <gagecres(a)discussions.microsoft.com> wrote in message > > news:5E01823D-4916-4E53-B80C-42D68C75743D(a)microsoft.com... > > I also noticed that the total records number always starts out as 1, even > > if > > I have more than 1 record in the subform associated with the current > > record > > on the parent form. For example, it says "Record 1 of 1" even though > > there > > are a total of 3 records. However, when I go to the next record in the > > subform it updates to the correct number of total records (i.e. "Record 1 > > of > > 3"). How do I get it to say "Record 1 of 3" for the subform record when I > > first get to the parent record? > > > > "Linq Adams via AccessMonster.com" wrote: > > > > > Private Sub Form_Load() > > > DoCmd.GoToRecord , , acNext > > > DoCmd.GoToRecord , , acFirst > > > End Sub > > > > > > > > > Private Sub Form_Current() > > > Me.Caption = "Record " & CurrentRecord & " Of " & > > > RecordsetClone.RecordCount & " Records" > > > End Sub > > > > > > This code places the info in the form's title area. To place it in a > > > Label, > > > substitute > > > > > > Me.LableName.Caption > > > > > > for > > > > > > Me.Caption. > > > > > > To place it in a TextBox, substitute > > > > > > Me.TextBoxName.Value > > > > > > for > > > > > > Me.Caption. > > > > > > -- > > > Message posted via AccessMonster.com > > > http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1 > > > > > > . > > > > > > > > > . > > > > > . >
From: gagecres on 5 Mar 2010 09:15 It is still not showing the correct total number. Here is my code: Private Sub Form_Current() intX = DCount("*", "Heirs Table") If intX < 1 Then Me.txt_Rec_Count.Value = "0" Else Me.txt_Rec_Count.Value = "Heir # " & CurrentRecord & " of " & RecordsetClone.RecordCount End If End Sub Private Sub Form_Load() DoCmd.GoToRecord , , acLast DoCmd.GoToRecord , , acFirst End Sub "Linq Adams via AccessMonster.com" wrote: > Sorry, the line > > DoCmd.GoToRecord , , acNext > > was a typo. Should have read > > DoCmd.GoToRecord , , acLast > > To account for no records being in the recordsource, try this revision > > Private Sub Form_Load() > DoCmd.GoToRecord , , acLast > DoCmd.GoToRecord , , acFirst > End Sub > > Private Sub Form_Current() > > Dim intX As Integer > > intX = DCount("*", "TableOrQueryName") > If intX < 1 Then > Me.Caption = "There Are No Records" > Else > Me.Caption = "Record " & CurrentRecord & " Of " & RecordsetClone. > RecordCount & " Records" > End If > > End Sub > > -- > Message posted via http://www.accessmonster.com > > . >
From: Gina Whipp on 5 Mar 2010 10:09 Is me txtRec_Count a numeric field? OR just and unbound text box? Please remove *.Value* Is this a form or subform and does it have any records? What message if any do you get? -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been denied critical, need to know, information!" - Tremors II http://www.regina-whipp.com/index_files/TipList.htm "gagecres" <gagecres(a)discussions.microsoft.com> wrote in message news:297E5FE8-BA21-4FB0-9A76-FD2E2F7B5EF7(a)microsoft.com... Here is the code I am using: With Me.RecordsetClone .MoveLast Me.txt_Rec_Count.Value = Me.CurrentRecord & " of " & .RecordCount & " line(s)" End With Also, I commented out the OnLoad lines "Gina Whipp" wrote: > Please post the exactly the code you are using here... And if you have no > reason for the DoCmd.GoToRecord lines, remove them from the On_Load event. > > -- > Gina Whipp > 2010 Microsoft MVP (Access) > > "I feel I have been denied critical, need to know, information!" - Tremors > II > > http://www.regina-whipp.com/index_files/TipList.htm > > "gagecres" <gagecres(a)discussions.microsoft.com> wrote in message > news:3843298D-90EB-473F-A75D-58E961D9AE0A(a)microsoft.com... > I still get an error saying: "No current record." When I debug it, it > highlights ".MoveLast". > > "Gina Whipp" wrote: > > > gagecres, > > > > I use on the On_Current event of the form... > > > > With Me.RecordsetClone > > .MoveLast > > Me.txtPage = Me.CurrentRecord & " of " & .RecordCount & " > > line(s)" > > End With > > > > Make sure to place a text box on your form names... *txtPage* > > -- > > Gina Whipp > > 2010 Microsoft MVP (Access) > > > > "I feel I have been denied critical, need to know, information!" - > > Tremors > > II > > > > http://www.regina-whipp.com/index_files/TipList.htm > > > > "gagecres" <gagecres(a)discussions.microsoft.com> wrote in message > > news:5E01823D-4916-4E53-B80C-42D68C75743D(a)microsoft.com... > > I also noticed that the total records number always starts out as 1, > > even > > if > > I have more than 1 record in the subform associated with the current > > record > > on the parent form. For example, it says "Record 1 of 1" even though > > there > > are a total of 3 records. However, when I go to the next record in the > > subform it updates to the correct number of total records (i.e. "Record > > 1 > > of > > 3"). How do I get it to say "Record 1 of 3" for the subform record when > > I > > first get to the parent record? > > > > "Linq Adams via AccessMonster.com" wrote: > > > > > Private Sub Form_Load() > > > DoCmd.GoToRecord , , acNext > > > DoCmd.GoToRecord , , acFirst > > > End Sub > > > > > > > > > Private Sub Form_Current() > > > Me.Caption = "Record " & CurrentRecord & " Of " & > > > RecordsetClone.RecordCount & " Records" > > > End Sub > > > > > > This code places the info in the form's title area. To place it in a > > > Label, > > > substitute > > > > > > Me.LableName.Caption > > > > > > for > > > > > > Me.Caption. > > > > > > To place it in a TextBox, substitute > > > > > > Me.TextBoxName.Value > > > > > > for > > > > > > Me.Caption. > > > > > > -- > > > Message posted via AccessMonster.com > > > http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1 > > > > > > . > > > > > > > > > . > > > > > . >
From: BruceM via AccessMonster.com on 5 Mar 2010 10:22 Try checking the RecordCount of RecordsetClone, and breaking up the code a little: Debug.Print Me.RecordsetClone.RecordCount Me.RecordsetClone.MoveLast Me.txt_Rec_Count = Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount & " line(s)" Rather than using the Load event, perhaps something like this: Dim lngCount as Long Dim strCount as String lngCount = Me.RecordsetClone.RecordCount If lngCount = 0 Then strCount = "First Record" Else strCount = Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount & " line(s)" End If Me.txt_Rec_Count = strCount gagecres wrote: >Here is the code I am using: > >With Me.RecordsetClone > .MoveLast > Me.txt_Rec_Count.Value = Me.CurrentRecord & " of " & .RecordCount & >" line(s)" > End With > >Also, I commented out the OnLoad lines > >> Please post the exactly the code you are using here... And if you have no >> reason for the DoCmd.GoToRecord lines, remove them from the On_Load event. >[quoted text clipped - 60 lines] >> >> . -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1
From: gagecres on 9 Mar 2010 09:19 txt_Rec_Count is an unbound text box. I removed ".Value" and still got the same No Current Record error. The form is a subform and yes it does have records in it. "Gina Whipp" wrote: > Is me txtRec_Count a numeric field? OR just and unbound text box? Please > remove *.Value* Is this a form or subform and does it have any records? > > What message if any do you get? > > -- > Gina Whipp > 2010 Microsoft MVP (Access) > > "I feel I have been denied critical, need to know, information!" - Tremors > II > > http://www.regina-whipp.com/index_files/TipList.htm > > "gagecres" <gagecres(a)discussions.microsoft.com> wrote in message > news:297E5FE8-BA21-4FB0-9A76-FD2E2F7B5EF7(a)microsoft.com... > Here is the code I am using: > > With Me.RecordsetClone > .MoveLast > Me.txt_Rec_Count.Value = Me.CurrentRecord & " of " & .RecordCount & > " line(s)" > End With > > Also, I commented out the OnLoad lines > > "Gina Whipp" wrote: > > > Please post the exactly the code you are using here... And if you have no > > reason for the DoCmd.GoToRecord lines, remove them from the On_Load event. > > > > -- > > Gina Whipp > > 2010 Microsoft MVP (Access) > > > > "I feel I have been denied critical, need to know, information!" - Tremors > > II > > > > http://www.regina-whipp.com/index_files/TipList.htm > > > > "gagecres" <gagecres(a)discussions.microsoft.com> wrote in message > > news:3843298D-90EB-473F-A75D-58E961D9AE0A(a)microsoft.com... > > I still get an error saying: "No current record." When I debug it, it > > highlights ".MoveLast". > > > > "Gina Whipp" wrote: > > > > > gagecres, > > > > > > I use on the On_Current event of the form... > > > > > > With Me.RecordsetClone > > > .MoveLast > > > Me.txtPage = Me.CurrentRecord & " of " & .RecordCount & " > > > line(s)" > > > End With > > > > > > Make sure to place a text box on your form names... *txtPage* > > > -- > > > Gina Whipp > > > 2010 Microsoft MVP (Access) > > > > > > "I feel I have been denied critical, need to know, information!" - > > > Tremors > > > II > > > > > > http://www.regina-whipp.com/index_files/TipList.htm > > > > > > "gagecres" <gagecres(a)discussions.microsoft.com> wrote in message > > > news:5E01823D-4916-4E53-B80C-42D68C75743D(a)microsoft.com... > > > I also noticed that the total records number always starts out as 1, > > > even > > > if > > > I have more than 1 record in the subform associated with the current > > > record > > > on the parent form. For example, it says "Record 1 of 1" even though > > > there > > > are a total of 3 records. However, when I go to the next record in the > > > subform it updates to the correct number of total records (i.e. "Record > > > 1 > > > of > > > 3"). How do I get it to say "Record 1 of 3" for the subform record when > > > I > > > first get to the parent record? > > > > > > "Linq Adams via AccessMonster.com" wrote: > > > > > > > Private Sub Form_Load() > > > > DoCmd.GoToRecord , , acNext > > > > DoCmd.GoToRecord , , acFirst > > > > End Sub > > > > > > > > > > > > Private Sub Form_Current() > > > > Me.Caption = "Record " & CurrentRecord & " Of " & > > > > RecordsetClone.RecordCount & " Records" > > > > End Sub > > > > > > > > This code places the info in the form's title area. To place it in a > > > > Label, > > > > substitute > > > > > > > > Me.LableName.Caption > > > > > > > > for > > > > > > > > Me.Caption. > > > > > > > > To place it in a TextBox, substitute > > > > > > > > Me.TextBoxName.Value > > > > > > > > for > > > > > > > > Me.Caption. > > > > > > > > -- > > > > Message posted via AccessMonster.com > > > > http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201003/1 > > > > > > > > . > > > > > > > > > > > > > . > > > > > > > > > . > > > > . >
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: re-linking backend on shared folder Next: Disallow field sorting by users |