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??
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??
Did you try the numeric format I posted? That error is typically a result of that issue.
Yes... now I get "Run-time error '3075': Syntax error (missing operator) in query expression 'Session = Session 1'
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.
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.
Can you post the db with the current setup?
Back from the weekend!
Here's my DB.
Attachment 3389
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.
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...
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.
I put the code in, I'm still getting the same error message.
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
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?
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