By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,308 Members | 1,929 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,308 IT Pros & Developers. It's quick & easy.

Multiple entries from a drop down list

P: 19
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!

Atlante

P.S.
I'm using the Access2003
Attached Files
File Type: zip Copy of database.zip (28.0 KB, 106 views)
Aug 4 '09 #1
Share this Question
Share on Google+
5 Replies


ADezii
Expert 5K+
P: 8,679
@atlanteavila
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

P: 19
Yes, that's the one I would like to use. Thank you!
Aug 4 '09 #3

ADezii
Expert 5K+
P: 8,679
@atlanteavila
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

P: 19
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

ADezii
Expert 5K+
P: 8,679
@atlanteavila
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
  4.  
  5. 'Are there already Records in the Sub-Form based on the Current [CID]?
  6. intNumOfRelatedRecords = DCount("*", "[Registrations]", "[CID] = " & Me![CID])
  7.  
  8. If intNumOfRelatedRecords > 0 Then Exit Sub   'Related Records exist
  9.  
  10. Set MyDB = CurrentDb()
  11. Set rstClasses = MyDB.OpenRecordset("Classes", dbOpenForwardOnly)
  12.  
  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
  20.  
  21. Forms![Contacts]![Registrations Subform].Form.Requery
  22.  
  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.