Results 1 to 6 of 6
  1. #1
    Rramjet is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2013
    Posts
    36

    Me.OrderBy not working

    Hi all -



    back again... Little problem. Huge frustration.

    The first OrderBy works perfectly - the second does not. The fields have exactly the same parameters (in fact they are the same field located on different forms). If manually right click - I can Sort A-Z ... so if I can do that - then there should be nothing preventing a sort command from working, so why doesn't it work?

    Private Sub BITSEA_New_Record_button_Click()
    Me.OrderBy = "BITSEA_ID ASC"
    Me.OrderByOn = True
    DoCmd.GoToRecord , , acLast
    DoCmd.Close acForm, "BITSEA_Add_New", acSaveYes
    DoCmd.OpenForm "BITSEA"
    DoCmd.GoToControl "BITSEA_ID"
    Me.OrderBy = "BITSEA_ID ASC"
    Me.OrderByOn = True
    DoCmd.GoToRecord , , acLast
    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    These two forms have same dataset? Why use two forms?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Rramjet is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2013
    Posts
    36
    *Sigh* - it's a workaround to get around Access many many limitations and bugs. The main form(s) display demographic information from a CLIENT table (in the header) and allow data entry in the body for the various outcome measures the clients complete (one form per outcome measure). Unfortunately this structure does not allow for the creation of new records where a client does not already have an outcome measure (it runs into the "notinList" error). So ...I create another form, accessed by a "New Record (manual creation)" button that allows a new Client URN (for that particular OM) to be entered (like a URN). THEN what I have to do is close that form and re-open the primary OM form - and find that new record so data can be entered - and the easiest way to do THAT is to sort by the autogenerated ID number and go to the last record... BUT, The command simply will not work... hence my question. What could possibly stop it from working?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Sorry, can't follow that. I don't understand the 'limitations and bugs' you feel must be worked around. If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Rramjet is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2013
    Posts
    36
    LOL. Yeah - just blowin' off a little steam (but get an error in your form and it can turn "sticky" on you and you have to wipe the whole form and start again is frustrating...). ...and Access just is frustrating. Just when you think you have it pinned, it stops working on you. ..and that VBa code is seriously difficult to fathom... (at least some of the logic of it escapes me ..it's like they did it that way not because it makes sense - but just because they could!) But then - what do I know = nothing obviously...

    All I really want to know are the probable causes for a field that is accessible and not locked not to be able to be sorted using the OrderBy code. Is it possible for the query sort order to prevent the code from operating for example? What other things might it be? The placement of the field (header/body/footer), the fact that there is a tab control on the form containing a subform on one of the tabs ...I need some clues - like "have you thought about..."

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Never seen code like this and I have no experience with this issue so I need to do testing with the structure. Since I don't already have this and don't want to build, you could provide yours for analysis. I still don't understand why two forms.

    Access is the only database I have any real experience with and I don't find it so daunting but then ignorance is bliss? I have worked a little with old DOS dbase4 when we migrated from that to Access. Now if you want a challenge as an amateur developer, give that one a go. No GUI tools and wizards to hold your hand.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 04-03-2012, 12:00 PM
  2. OrderBy Not working for select few cases
    By walter189 in forum Programming
    Replies: 2
    Last Post: 08-19-2011, 05:53 AM
  3. prompt for orderby in report
    By nkuebelbeck in forum Access
    Replies: 2
    Last Post: 08-18-2011, 12:57 PM
  4. Form Filter/OrderBy Issue
    By Gray in forum Forms
    Replies: 2
    Last Post: 05-13-2011, 03:10 PM
  5. OrderBy Losing Criteria
    By P5C768 in forum Forms
    Replies: 1
    Last Post: 01-21-2011, 01:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums