INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Why isn't this code working?

Why isn't this code working?

(OP)
The code I'm trying to use:

Private Sub cboModel_AfterUpdate()
Dim stQueryName As String
Dim stFormName As String
stQueryName = "qryModelParameter"
stFormName = "frmDesktopsByModel"
DoCmd.OpenQuery stQueryName, acViewNormal, acEdit
DoCmd.Close acForm, stFormName
End Sub

What it's failing to do:

I want a parameter query with a list of options for the user to choose from to open a query displaying the results. This gives me a list of options but does nothing when I click any given option.

What I'd like to do:

I'd like to use 12 button controls to represent each month. I'd like some sort of control beneath those buttons that will display the results of a parameter query that finds records limited to the users selected month. I'd then like the user to be able to double click a record to open a new form in which the ID (or other fields tied to that ID) of the selected record is already filled in on an input form. Additionally, I need some way to make a validation rule that prevents more than 12 records to be tied to a given ID.


If that's not making sense, I'll try to clarify. I'm trying to create a scheduling system. I have 10-15 classes per month. Each class can hold 6-12 students. These classes are only 4 hours, start to finish, and each student only needs to take a class once every two years. I'm simply trying to make a user friendly means of recording which students are registering for which classes, as well as a user friendly way to view available classes and spaces.

Currently, I've managed to create a query (thanks to this forum) that shows me the data I need. I've got my tables and relationships functional. I'm stuck at the dreaded coding stage, trying to figure out how to help users view data and input records. Any help would be deeply appreciated!

RE: Why isn't this code working?

You should never open a query. You use a query as the record source of a form or a report.

All parameters must come from controls on forms.

You should probably be selecting a month and year. I would do all of this with a single form. Select a month and year from a combo box which then filters another combo box with classes that have a column with the number of students currently enrolled. This combo box could have a row source that prohibits displaying if the enrollment is maxed out.

I also think you need to get the registration out of your student table. There should be a separate junction table that has one record per student per class.

Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close