Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    Join Date
    May 2011
    Posts
    22
    Alas... now it says: Run-time error '32502': The value you entered isn't valid for the field "ClassID".



    I didn't change anything. What is going on??

  2. #17
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Did you try the numeric format I posted? That error is typically a result of that issue.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #18
    Join Date
    May 2011
    Posts
    22
    Yes... now I get "Run-time error '3075': Syntax error (missing operator) in query expression 'Session = Session 1'

  4. #19
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Your field in the classes table is probably the numeric ID field, but your combo is returning the text value ("Session 1" instead of 1). I have to leave for lunch, but see if you can adjust the combo to return the number instead of the text. It can display the text, but the bound column should be the number.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #20
    Join Date
    May 2011
    Posts
    22
    Hum... I changed the list boxes to combo boxes, so now it only displays the number as you suggested. But now I'm getting the "Missing Operator" error I posted before.

  6. #21
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Can you post the db with the current setup?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #22
    Join Date
    May 2011
    Posts
    22
    Back from the weekend!

    Here's my DB.

    Attachment 3389

  8. #23
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I think it's confused because the subform/combo are bound, which they likely shouldn't be (certainly not the combo). If I remove the control source of the combo it works as expected. It doesn't pull any records because your session ID's are 10-12 but you entered 1-2 in the classes table.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #24
    Join Date
    May 2011
    Posts
    22
    Ummm I suppose I'm not understanding correctly. I removed the control source for the combo as well, and it makes no difference, I still get the same error message when I try to use the button.

    Also, the SessionID's start with 10 because of the darn autonumber. I can't figure out how to restart it back to 1...

  10. #25
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I forgot I also did this:

    DoCmd.OpenForm "Classes", , , "Session = " & Me.Session.Column(0)

    The autonumber shouldn't really matter (they are typically invisible to the user), but if you empty the table and then do a compact/repair, it may reset the number back to 1.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #26
    Join Date
    May 2011
    Posts
    22
    I put the code in, I'm still getting the same error message.

  12. #27
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I am getting senile, so maybe I changed something else. Here's the one that works for me.
    Last edited by pbaldy; 03-02-2012 at 03:08 PM. Reason: Attachment removed to reduce board clutter
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #28
    Join Date
    May 2011
    Posts
    22
    Er, that one returns the same error message as well???

    I tried something else, but I really have no idea if this is accomplishing what I want. In my subform I removed the Session combo box and replaced it with the SessionID box. In my Classes form, I added the SessionID field as well. I changed the code to this:

    DoCmd.OpenForm "Classes", , , "SessionID = " & Me.SessionID

    and now it opens just fine. But will this work for filtering out the sessions/periods/classes I need?

  14. #29
    Join Date
    May 2011
    Posts
    22
    OH.... I think I just realized something I was doing wrong. Previously the "Session" field's control source in my subform was "Session," not "Session ID", and same for in my Classes form. I think that was what was causing my issues, from what I can tell...

    Now when I use the button the form opens just fine, but still has all classes available, not just the ones in that particular session. Do you know how to fix that?

    Also, I will need to sort out classes from a particular period within the session. Should I follow the same method?

    Here's my updated DB just in case... Attachment 3391

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 03-03-2011, 03:56 PM
  2. cmd button to open form
    By stephaniehpcswf in forum Access
    Replies: 1
    Last Post: 02-23-2011, 04:46 PM
  3. Use a command button to open a form
    By johnpaul in forum Forms
    Replies: 24
    Last Post: 09-23-2010, 12:29 PM
  4. Open Form with information from previous form
    By jheintz57 in forum Forms
    Replies: 9
    Last Post: 03-23-2010, 07:30 AM
  5. Replies: 3
    Last Post: 10-16-2009, 07:54 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