467,889 Members | 1,400 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,889 developers. It's quick & easy.

Multiple entries from a drop down list

Hello all,

I've attached a database here that we're using to register people for a series of classes, for a course that we're offering for pre-baptismal certification.

I'm wondering if there is a way that we could use one selection from the drop down list to auto populate the entire course dates in the sub form. That way, we would only select one item instead of having to select every class individually for every person that registers.

I hope that's clear enough please take a look at the contacts form to get a better idea of what I'm trying to do.

Thanks for your help in advance!


I'm using the Access2003
Attached Files
File Type: zip Copy of database.zip (28.0 KB, 114 views)
Aug 4 '09 #1
  • viewed: 2461
5 Replies
Expert 8TB
The only Drop-Down I see is the Date Field in the Registrations Sub-Form. Is this what you are referring to?
Aug 4 '09 #2
Yes, that's the one I would like to use. Thank you!
Aug 4 '09 #3
Expert 8TB
Are you requesting that if the User selects 'ANY' Date from the Date Drop-Down that it (Sub-Form) should be populated with 'ALL' available Dates? If my assertion is correct, the only thing that makes any kind of sense to me is that the Sub-Form is automatically populated after a Record is added to the Main Form. Is this logic, assuming the previous is correct, acceptable to you? In my thinking, you can run into a lot of problems, and a lot of coding any other way.
Aug 4 '09 #4
Well sort of. I'm thinking I may need to add another drop down field and once I select something like full course from that field, the after update comes in and automatically adds all of the classes to the sub-form. Sounds a little far fetched but we have over 200 people that are planning to attend this course and it's just driving me crazy having to select every class for these registrants. Any help would be great or if you can think of a different work around I wouldn't mind going with anything at this point. It's just so time consuming!

Thanks for your help!
Aug 4 '09 #5
Expert 8TB
When I get a chance, I'll create some Generic Code that will automatically populate the Sub-Form with all the available Dates. How to implement it, I'll leave up to you. Actually, I made this a Rush Job before I went to bed. The following Code should work rather nicely for you:
Expand|Select|Wrap|Line Numbers
  1. Dim intNumOfRelatedRecords As Integer
  2. Dim MyDB As DAO.database
  3. Dim rstClasses As DAO.Recordset
  5. 'Are there already Records in the Sub-Form based on the Current [CID]?
  6. intNumOfRelatedRecords = DCount("*", "[Registrations]", "[CID] = " & Me![CID])
  8. If intNumOfRelatedRecords > 0 Then Exit Sub   'Related Records exist
  10. Set MyDB = CurrentDb()
  11. Set rstClasses = MyDB.OpenRecordset("Classes", dbOpenForwardOnly)
  13. With rstClasses
  14.   Do While Not .EOF
  15.     CurrentDb.Execute "Insert Into [Registrations] ([CID], [Date]) Values (" & _
  16.                        Me![CID] & ", '" & ![ClassID] & "');", dbFailOnError
  17.     .MoveNext
  18.   Loop
  19. End With
  21. Forms![Contacts]![Registrations Subform].Form.Requery
  23. rstClasses.Close
  24. Set rstClasses = Nothing
Aug 5 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Therese A. Sorna | last post: by
4 posts views Thread by Abbey Krystowiak | last post: by
1 post views Thread by Aaron Prohaska | last post: by
8 posts views Thread by Ed Dror | last post: by
1 post views Thread by Jeff Gardner | last post: by
6 posts views Thread by Igor | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.