From: gagecres on 9 Mar 2010 09:26 This did the trick. Thanks a lot! "BruceM via AccessMonster.com" wrote: > 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:38 Spoke too soon. "gagecres" wrote: > This did the trick. Thanks a lot! > > "BruceM via AccessMonster.com" wrote: > > > 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:57 The code you gave me works fine if the first parent record that appears on the form has records in the subform. If that first parent record has no records in the subform, that's when I get the "No Current Records" error as soon as I open the database and the debugger highlights the ".MoveLast" statement. "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 > > > > > > > > . > > > > > > > > > > > > > . > > > > > > > > > . > > > > . >
From: Gina Whipp on 9 Mar 2010 10:01 gagecres, Since all of the code you received here should work, let's check a few othwer things... 1. This subform isn't continuous is it? 2. How is the subform bound to the main form? 3. Is the code on the subform or the main form? 4. Is the code on the On_Current event of the subform? -- 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:0E9EE9FC-054F-42E8-892B-287EB1F1E3E9(a)microsoft.com... 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 > > > > > > > > . > > > > > > > > > > > > > . > > > > > > > > > . > > > > . >
From: Gina Whipp on 9 Mar 2010 11:22 Okay, then let's forget that and use this... Create a text box and copy/paste the below... =IIf([CurrentRecord]>(Count(*)),'No Record',('Contract ' & [CurrentRecord] & ' of ' & Count(*))) & " line(s)" Note, where is says 'No Record', you can have it say anything or nothing. -- 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:CF04DD6F-2837-4EAB-99D1-EE2D04469458(a)microsoft.com... The code you gave me works fine if the first parent record that appears on the form has records in the subform. If that first parent record has no records in the subform, that's when I get the "No Current Records" error as soon as I open the database and the debugger highlights the ".MoveLast" statement. "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 |