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

Need Help with Access Form

P: 1
I am wanting to create a form in access to record training hours of my fire department. I have my form created and want to be able to enter multiple ID numbers for each training session so that when I enter it it will post the training title and hours to individual rows in the training table. How can I create such a for so I don't have to re-enter redundant information for each members ID?

I am using MS Access 2003.

I have limited knowledge with Access and this one is stumping me.

Thanks in advance,

Doug
Nov 21 '06 #1
Share this Question
Share on Google+
1 Reply


MMcCarthy
Expert Mod 10K+
P: 14,534
Try this ...

Create a list box on your form of the ID's (e.g. lstIDs). In the properties window for the listbox under the Other tab set the Multi Select property to Simple.
This will allow you to select multiple values by holding down the control key.

Create a command button (e.g. cmdTrainingHours). In the click event put something like the following:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdTrainingHours_Click()
  3. Dim iSelect As Variant
  4.  
  5.   For Each iSelect In lstIDs.ItemsSelected
  6.     strSQL = "INSERT INTO training (ID, Title, TrainingHours) VALUES " & _
  7.       "(" & lstIDs.ItemData(iSelect) & ",'" & <title value here> & "'," & <hours value here> & ");"
  8.     DoCmd.RunSQL
  9.   Next i
  10.  
  11. End Sub
  12.  
This is the best I can do without more information on how you're calculating the hours and getting the title.



I am wanting to create a form in access to record training hours of my fire department. I have my form created and want to be able to enter multiple ID numbers for each training session so that when I enter it it will post the training title and hours to individual rows in the training table. How can I create such a for so I don't have to re-enter redundant information for each members ID?

I am using MS Access 2003.

I have limited knowledge with Access and this one is stumping me.

Thanks in advance,

Doug
Nov 21 '06 #2

Post your reply

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