Results 1 to 12 of 12
  1. #1
    Zukster is offline Novice
    Windows 98/ME Access 2003
    Join Date
    Aug 2009
    Posts
    15

    Sorting main-form from a sub-form

    I have two forms



    A main form - frmManager with ManagerID and DivisionID

    Another form - frmDivisionOrder with ManagerID and DivisionID and Division

    I want to sort my main form by Division.

    What code can I put in to pull that info.

    I also have a dlookup on the main form pulling the Division so if I can sort off of the dlookup that would be great.

    Thanks!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If I understand your question correctly, You would do that with an ORDERBY clause in the RecordSource of the MainForm which should be a query and not directly to a table.

  3. #3
    Zukster is offline Novice
    Windows 98/ME Access 2003
    Join Date
    Aug 2009
    Posts
    15
    the record source is a table. I have to have it updatabale and by the time I add ALL of the tables (4 of them) I can no longer update to the form.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    A query is updateable under most conditions. Are you saying your table is made up from 4 different tables? I believe this link will be helpful.

  5. #5
    Zukster is offline Novice
    Windows 98/ME Access 2003
    Join Date
    Aug 2009
    Posts
    15
    That article helped alot and I think I've identified the problem.

    One table has ManagerID as an autonumber and the other has ManagerID as a number.

    It is this relationship that isn't working to allow updates to the form. The records are identicle. Any suggestions?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    An AutoNumber PrimaryKey *should* be a LongInteger field in another table as a ForeignKey. Is that what you have?

  7. #7
    Zukster is offline Novice
    Windows 98/ME Access 2003
    Join Date
    Aug 2009
    Posts
    15
    Whoa.... you're going to lose me.

    In Table: Manager District - the ManagerID is a long integer (not primary key)

    In Table: Table Managers - the ManagerID is an autonumber and there is NOT a primary key for the table

    when I put both tables in a query they do not automatically join like other fields. I can join them and it all works fine (at least I think it does) but that is the element in the form that is not working.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Does Table: Table Managers have a PrimaryKey and if so, why isn't it the ManagerID field?

  9. #9
    Zukster is offline Novice
    Windows 98/ME Access 2003
    Join Date
    Aug 2009
    Posts
    15
    It was in the ManagerID field. Some of our managers have more than one district so I overwrote the table and now have duplicate records and it won't allow me to add the primary key to the ManagerID field.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Oops! I would think that a Manager has one ID but can be in more than one District table as a ForeignKey.

  11. #11
    Zukster is offline Novice
    Windows 98/ME Access 2003
    Join Date
    Aug 2009
    Posts
    15
    Yeah, I think I messed up...

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is it fixable? Does the District table have a ForeignKey field for the ManagerID?

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

Similar Threads

  1. Auto Populate Data from Main Form
    By billiejean in forum Forms
    Replies: 0
    Last Post: 08-05-2009, 08:08 AM
  2. Replies: 0
    Last Post: 03-11-2009, 12:39 PM
  3. Replies: 0
    Last Post: 12-16-2008, 07:49 AM
  4. Sorting in a form
    By PaulDouglas in forum Forms
    Replies: 3
    Last Post: 07-27-2006, 08:28 AM
  5. Subform vs main form calculation
    By fadone in forum Forms
    Replies: 17
    Last Post: 12-21-2005, 07:27 AM

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