Here is my DB:
Attachment 3367
What I am trying to figure out is the best way to have, when the button is pressed, class form open with ONLY classes relative to the session selected. How can I do this?
Here is my DB:
Attachment 3367
What I am trying to figure out is the best way to have, when the button is pressed, class form open with ONLY classes relative to the session selected. How can I do this?
I'm not exactly sure how to use that code for my form. Did you look at my form? What I want is for when Session 1 is chosen from the drop-down, all classes in that session will appear (either on that form or by opening a new form...)
How would I apply your code for this?
You can either use the Where Condition argument in your existing macro, or replace the macro with the VBA code equivalent, which is what I have in the link. If you're unsure how to put in VBA code:
http://www.baldyweb.com/FirstVBA.htm
I'm still unsure of how to make your code work with my DB. Would this be correct?
DoCmd.OpenForm "Classes", , , "Session = '" & Me.Still not sure what to put here??? & "'"
Me.TheNameOfTheControlContainingTheSession
Control means textbox, combo, etc.
Okay...
Now here's my problem. I have the button set (thanks to your help!) to open the Classes form. But it's opening the form with ALL classes, even though I enter the parameter value for Session 1 when it opens. I only want it to make available classes that are in the desired session. How do I do this?
Here's is my DB:
Attachment 3371
I need it to open the classes within the selected session... when those are opened, I want to have a list box to choose a class period (Period 1, Period 2, Period 3, or Period 4) and for that command to, in turn, make available only the classes within that period.
You get the parameter prompt because there is no session field in the data source of the classes form. I don't know your data well enough to know the relationship, but this technique requires the field be in the source (that's the only way it can filter it).
I put it in and now the form shows nothing when I open it...
Put what in? As I see it, there's no way for the program to know what classes are associated with what session. I'd expect a session field in the classes table.
Disregard my last post...
Yeah, that's what I was thinking. I added Session and Period to the Classes table. This should allow me to filter which appears on the class form that opens, correct?
Yes; once the source of the classes form includes a session field, that code should work. If you use a numeric ID field like in the sessions table, it would be:
DoCmd.OpenForm "Classes", , , "Session = " & Me.Session
Intriguing name by the way. I'm married to a DarkAndLovely woman.
How funny. My name is based off a piece of poetry back from the Bible days, lol.
Anyway, there's a problem. Here's the code I have entered for my button:
DoCmd.OpenForm "Classes", , , "Session = '" & Me.Session & "'"
When I click I get the error message: "Run-time error '3464': Data type mismatch in criteria expression.
What to do?