Navigation Button error (using Access 2007)

I am using my own Navigation Buttons for my form with an lblNavigate label.
(I created lblNavigate  on the form by using three spaces.)  I am using
lblNavigate to try and duplicate the record "x of y" label that appears in
the standard navigation toolbar).  I found some code that works except for
one problem:  When I open the form it says 1 of 501 instead of 1 of 1564.  I
have to press the Next button and then the previous button to get the
accurate count.  Any ideas of what’s causing this error?

I put the below code in the form's On Current Event:

     Private Sub Form_Current()

     On Error GoTo ErrorHandler

         If Me.NewRecord Then
             Me!lblNavigate.Caption = "New Record"
         Else
             With Me.RecordsetClone
                 .Bookmark = Me.Bookmark
                 Me!lblNavigate.Caption = .AbsolutePosition + 1 _
                     & " of " & .RecordCount
             End With
         End If


         Me.txtCompanyName.SetFocus


     CleanUpAndExit:
         Exit Sub

     ErrorHandler:
         Call MsgBox("An error was encountered" & vbCrLf & vbCrLf & _
             "Description:  " & Err.Description & vbCrLf & _
             "Error Number:  " & Err.Number, , "Error")
         Resume CleanUpAndExit

     End Sub


Thanks for your help!

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/3/2010 5:45:16 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

3 Replies
814 Views

Similar Articles

[PageSpeed] 21

Access doesn't always load all of the records on opening. Use this to force
it to do so:

Private Sub Form_Load()
  DoCmd.GoToRecord , , acLast
  DoCmd.GoToRecord , , acFirst
End Sub

-- 
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
Linq
6/3/2010 5:51:47 PM
Beautiful!  Thank you very much!


Linq Adams wrote:
>Access doesn't always load all of the records on opening. Use this to force
>it to do so:
>
>Private Sub Form_Load()
>  DoCmd.GoToRecord , , acLast
>  DoCmd.GoToRecord , , acFirst
>End Sub
>

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/3/2010 5:56:38 PM
You know Linq I just thought of something.

Why does MS Access navigation bar give the correct number on load?

Linq Adams wrote:
>Access doesn't always load all of the records on opening. Use this to force
>it to do so:
>
>Private Sub Form_Load()
>  DoCmd.GoToRecord , , acLast
>  DoCmd.GoToRecord , , acFirst
>End Sub
>

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
lmcc
6/3/2010 6:44:12 PM
Reply:

Similar Artilces:

Excel not Access
I have designed an Access database that holds records relating to my stores audit results going back for about 5 years plus a load more information relating to these stores. This was used to produe a pack once a month, however a change in senior management means that I have got to shelve this and prodce a similar pack in Excel. The idea would be that the user could select a month or a 12 mnth date range that would produce data that could then be used to populate a number of excel templates that have been designed. Having not used excel for years I would be grateful for any suggestion...

XCH Error 3092, OAB replication
I am getting error 3092 for OAB in Exchnage 2003 (migrated from 5.5) "Error 1129 occurred while processing a replication event. Folder: (3-8) NON_IPM_SUBTREE\OFFLINE ADDRESS BOOK\EX:/o" Tried to delete offilne addressbook and recreate but error has not stopped. Any help will be a great help on where to look to get rid of this issue. Thanks ...

Rollup 2 and Office 2007
I already have Roll Up 1 and the Office 2007 compatibility patch installed. If I now install roll up 2 will I have to reinstall the office 2007 compatibility? yes -- Regards, MS CRM Certified Professional http://microsoftcrm3.blogspot.com Chat with me on MSN / Gmail / Skype : ID Is :.. mscrmexpert@gmail.com "LLoyd" wrote: > I already have Roll Up 1 and the Office 2007 compatibility patch installed. > If I now install roll up 2 will I have to reinstall the office 2007 > compatibility? ...

Error Generating the Offlice Address Book
I have a mixed site with 3 5.5 server and 4 2003 servers. I installed 2003 SP1 a few weeks back and since then I'm having an issue generating my Offline Address Book. Here the event log messages I'm getting. Event ID 9331: OALGen encountered error 80040107 (internal ID 501023d) accessing the public folder store while generating the offline address list for address list '/'. - Default Offline Address List For more information, click http://www.microsoft.com/contentredirect.asp. Event ID 9335: OALGen encountered error 80040107 while cleaning the offline address list public ...

Using expression builder object
Hi, I'm developing a wizzard in Access which builds import templates for various data sources to a fixed set of tables. In step 3 the users must be able to build an expression ; for instance Left([Fieldx],20) . Now I would like to have a command button on my form which calls the Access expression builder to allow the users to use this to build the expression. This expression will then be stored in a text box linked to the templates table. Anybody know how to call and use this object from VBA code? -- Kind regards Noëlla DoCmd.RunCommand acCmdInvokeBuilder I th...

Customized Toolbar RestoreState() fails if it has only 1 button
This issue happens only when the numbers of buttons in the tool bar is "1". Thats is, the user launches the customize toolbar dialog and removes all but 1 tool bar button. I have multiple Tool bars which I persist on application close and restore on application load. The SaveState() works fine as I notice the value "55 81 00 00" saved if only 1 button is left in the Tool bar. Here is the code for the RestoreState for (int i = 0; i < m_ToolBars.GetSize(); i++) { HKEY hSecKey = AfxGetApp()->GetSectionKey("Tool Bars"); if (hSecKey == NULL) break; CS...

Input Excel 'Password to Open' through control in access form
Hi All, We know,Excel has prompt password to open it files. Is it possible to create a code that can supplies the excel prompt password?.So that when we open the excel file through our access control in a form, the excel files can be opened automatically.But when the excel files opened from its default icon,it will prompt a password first. ...

Using part of a cell in a chart title
I have a chart which should get a title. However, this should be partly be used from a cell e.g. "counted with 5%" 5% should be taken from the cell and used in the title. Is this possible? Hi, Yes it's possible but all of the chart title needs to be in the cell. So you may need to use a helper cell and concatenate text and value. http://www.andypope.info/tips/tip001.htm Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Nicole" <Nicole@discussions.microsoft.com> wrote in message news:5CB7A971-AA7F-4C34-BB42-7DC283AA2958@micro...

Excel 2007
When I select cells to copy as a picture in Excel 2007, the resolution is terrible. Text and objects with shadow's are very blotchy when pasting the picture. How do you change the resolution of a 'Copy Picture'? ...

Error: Invalid byte was found at byte index 63.
Does anyone know what this means: "Invalid byte was found at byte index 63. " If yes, please help. Apogee Apogee wrote: > Does anyone know what this means: > > "Invalid byte was found at byte index 63. " That means exactly what it says: At index 63 XML parser found a byte, which is invalid either according document's encoding or is forbidden in XML documents at all (see list of allowed in XML characters at http://www.w3.org/TR/2000/REC-xml-20001006#charsets) -- Oleg Tkachenko http://www.tkachenko.com/blog Multiconn Technologies, Israel ...

Grammar check not working
Hello, I am using Word 2007 and have a problem with grammar and punctuation errors. I deliberately put two spaces between words, do not put space after a comma, write long sentences and finish a sentence without a verb but the green underline never appears. The spell check is functioning properly, no problem with that. In Word Options > Proofing, "Mark grammar errors as you type" is selected. I changed that selection and tried again but it still did not work. I used different languages as default language but no change. I would be grateful if someone could come...

How do I use traffic lights in excel
I am wanting to use traffic lights in excel that change colour based on the result of a variance cell, ie if the result of the cell is 10 make the traffic light green, if it is 20 make the traffic light amber, if the result is 30 make the traffic light red. How do I do this? Shorty Format>Conditional Formatting>Cell Value is: Note: you can add up to 3 conditions(4 if you count default) Gord Dibben Excel MVP On Wed, 22 Dec 2004 16:35:03 -0800, Shorty <Shorty@discussions.microsoft.com> wrote: >I am wanting to use traffic lights in excel that change colour based on the &g...

Filter recordset using query results
Hi all I have a form based on a query called [qry Quarterly Planning], it lists all Itineraries on the system. On this form you can filter records by specifying a Start and End Date for the [ReviewDate] and/or [Specialist]. It is a subform on a main unbound form, lets call this Subform1. Along side this I have another subform (Subform2) which displays ReviewDates that exist against an Itinerary. In other words Subform1 has a start date of an activity and if the activity lasts longer than 1 day, then the additional dates are stored in Subform2 (ItineraryDates). Currently when I...

Radar chart in Access 2007 report
Can you add a Radar chart to an access 2207 report? ...

How to change font size on formula bar in Excell 2007
I don't find Tools>Options>General (as suggested in other post answers) in Excel 2007. On the Office button there is an Excel Options but it doesn't provide a method of changing font size on the office but. My font is so small I can barely see it. Office button>ExcelOptions>Popular tab>in the "When creating new workbooks" section, choose font and font size -- Kind regards, Niek Otten Microsoft MVP - Excel "jimwillie" <jimwillie@discussions.microsoft.com> wrote in message news:588AAC05-0F52-404E-AA01-128E70E02D0B@microso...

Invalid XML error when I open customization setting
I have a problem when I try to open customization setting after I import an entity. The system errored "Invalid XML" "The XML passed to the platform is not well-formed XML". Please recommend how to resolve this problem. Thanks. ...

Linker Error after upgrade from VC7.1
Hello all, After upgrading a VC7.1 project to visual studio 2005, it failed to build in the release configuration with the follwoing error : 1>nafxcw.lib(winocc.obj) : error LNK2005: "public: class CWnd * __thiscall CWnd::GetDlgItem(int)const " (?GetDlgItem@CWnd@@QBEPAV1@H@Z) already defined in InstallDlg.obj The debug build works fine. The project uses MFC in a static library. Well, after doing some research, it seems that this one is tied to the fact that in a release configuration, _AFX_ENABLE_INLINES is defined, so inline functions are embedded in the .obj file. Sure there...

Unexpected error message on closing an Excel file
Suddenly I am getting the following message when I try to close a workbook: "Your formula contains an invalid external reference to a worksheet. Verify that the path, workbook, and range name or cell reference are correct, and try again" The mysterious thing is that it does not happen consistently and that, after I click OK after the above message, I can still save the file. What might be the cause of this error message and can the "invalid reference" be tracked down using one of the utility add-ins such as J. Walkenbach's PUP? If it only happens when you close ...

Strange Access Denied Problem with Windows 7
I got a new computer about six months ago that came with Windows Vista Home Premium 64bit. Before that I had done all of my .NET development either on an XP Pro VM or my former XP Pro computer at home. Shortly after getting my new computer at home, I also got a license for VMWare to be able to test my software on multiple platforms and configurations. I had wrote an application originally in VB.NET that was a simple backup utility. It supports mutiple backup configurations. Any given copnfiguration would define a backup which would be a list of files to backup, a list of folders to ...

[b]Can I download Excel data to a MS Access database?[/b]
I've built an Excel 2002 form that I want our internal customers to access from our intranet, and use. Once completed, they will send it to us as an e-mail attachment. I'd like to be able to open it, and somehow download the data from the form into an MS Access 2002 database I've built (so that we don't have to rekey it into the database). Is this possible or even feasible? Any and all help is appreciated. Thanks. :D --------- Message sent via www.excelforums.com Hi in Access check 'File - Import External data' -- Regards Frank Kabel Frankfurt, Germany "...

DNS Error on Exchange
I am getting the following error on my Exchange server. What is my problem? Thanks. Event Type: Warning Event Source: smtpsvc Event Category: None Event ID: 2012 Date: 1/28/2005 Time: 12:01:53 PM User: N/A Computer: PUMA Description: SMTP could not connect to the DNS server '24.220.0.11'. The protocol used was 'UDP'. It may be down or inaccessible. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Data: 0000: d5 04 00 00 Õ... Is that a DNS server that's configured on your Exchange box? It shoul...

Using Visio HTML output within frames
Hi, I want to include visio HTML output in a frame of another html file. Unfortunately it is not working. I understood the problem is in vml_*.htm files. It is due to, the target arrtibute(pointing to _parent) in v:shapetype tag and href attribute (pointing to #) in v:shape tag. These attributes should point to "_top" and "<target-html-file>#" respectively inorder to work. I want to change these options while saving .vsd as web page? I would appreciate if you can help me in this regard. <v:shapetype id="VISSHAPE" target="_parent" coor...

error on upgrade: ID 4386
Hello, I am upgrading from DPM 2010 RC to DPM 2010 RTM, 64 bit version, on Win 2008 R2 standard. The RC is working without any issues. The upgrade scenario is supported. At the very end of the process the upgrade fails giving me the following. _____ The SQL Server installation failed because a restart was pending on this computer. Restart the computer and then start DPM Setup again. ID: 4386. Details: Unknown error (0x84be0bc2) _____ Restarting the server does not correct the issue. On the next attempt I am getting the same error message. Where to look for the pending rest...

Exchange 2007 across account search
Does Exchange 2007 has an option to search all users mail for keywords? That all SBS workgroup users can search for messages to/from all other users. Is there any advanced indexing system to speed up search results? Thanks! On Tue, 26 Jan 2010 14:22:12 +0200, "Ronald" <2omikk@gmail.com> wrote: >Does Exchange 2007 has an option to search all users mail for keywords? >That all SBS workgroup users can search for messages to/from all other >users. >Is there any advanced indexing system to speed up search results? > >Thanks! > Bunch of ...

McAfee 8.5.0i on access scan slows down MS Dynamics CRM web client
Our organization's McAfee 8.50i slows down MS Dynamics CRM v4 - on premise web client considerabley when loading forms and data. Besides completely disabling McAfee, does anyone know how to configure McAfee (or configure CRM) to ignore CRM related form and data loads. When disabling the oncaccess scan, or when disabling the scriptcan - it improves lookups from 8-9 seconds to 4-5 seconds. However, the organizatin policy is to have these enabled. What to do? We have the same behavior, and went we reported to Microsoft says that no solution has, then we buy and install Microsoft Securi...