Hey Guys,
I a newbie in VBA code and need some help. I have an access database and have the following structure:
I have two tables called player and sports. Also the table sport has a field name sportType, and every sports name belongs to a type 1, 2, or 3. So for example, Football has type 3, Tennis has type 2 etc etc..
I created a form which displays sports name from the query in a dropdown list with a submit button. Now if you select a sport name from a Dropdown and press submit, I want the onclick event to run the following logic in VBA with maybe a switch statment:
Case 1:
If the selected sport name has type 1, then open Reports called reportOne and display all the players with that type in reportOne
Case 2:
If the selected sport name has type 2, then open Reports called reportTwo and display all the players with that type in reportTwo
Case 3:
If the selected sport name has type 3, then open Reports called reportThree and display all the players with that type in reportThree
End
Is this possible in access with a vba script and what would be the correct syntax. I have attached a sample access file with sample data with the tables, query and the three reports to give a better idea on what I mean?
Thanks for any help and guidance
Ket
I a newbie in VBA code and need some help. I have an access database and have the following structure:
I have two tables called player and sports. Also the table sport has a field name sportType, and every sports name belongs to a type 1, 2, or 3. So for example, Football has type 3, Tennis has type 2 etc etc..
I created a form which displays sports name from the query in a dropdown list with a submit button. Now if you select a sport name from a Dropdown and press submit, I want the onclick event to run the following logic in VBA with maybe a switch statment:
Case 1:
If the selected sport name has type 1, then open Reports called reportOne and display all the players with that type in reportOne
Case 2:
If the selected sport name has type 2, then open Reports called reportTwo and display all the players with that type in reportTwo
Case 3:
If the selected sport name has type 3, then open Reports called reportThree and display all the players with that type in reportThree
End
Is this possible in access with a vba script and what would be the correct syntax. I have attached a sample access file with sample data with the tables, query and the three reports to give a better idea on what I mean?
Thanks for any help and guidance
Ket