DirtDiverKF
Registered User.
- Local time
- Yesterday, 16:51
- Joined
- Oct 17, 2011
- Messages
- 12
Hi everyone, I have ran into a couple of issues that I could use some help with. First is easy, second maybe not so.
View attachment accessforums.zip I hope this attachment works!
The zip above contains 3 images to help show the issue I am having. The database I am working on is for holding local gaming tournaments on the Xbox. I am not worried about brackets and all that, but I am wanting to keep up with members and award points, show entry fees, etc.
I have a create tournament form that I will use to create the actual tournament. In this form I have the Tournament name, Location (which pulls from a different table of just locations), the game we are playing (which pulls from a different table of just games) and the tournament date.
This data will be saved to a table that logs the game id and the location id which are tied to this table with relationships. I can then query later to pull the data like address and all that.
The location and game are both combo boxes which transfers with them the id number which are auto numbers in the original tables, the locations and games tables. The combo box will show you the location name and city state and game will show the console and mature rating.
Thats what is going on, and is working fine, however, what if the location of the tournament dont exist and i want to add it on the fly? Or if the game dont exist and I want to add it on the fly? I added buttons next to these combo boxes that will pull up a form for adding a location. First issue is that the form opens with the first id item in the fields and I want it to be blank for a new location. What is the vba code to do this?
Second problem I am having is this, when i do fill in the add location form and hit save, it adds it to the table as it should, but when i go back to the create tournament form, the data is not in the combo box and i have to hit refresh to do it. I would rather not have to do this but would like the info in that combo box already. I have tinkered with some refresh vba commands (i get cant refresh now or something) and tried some requeries but no luck with either. I can gladly share the database with anyone that needs it to work through. The code below is the code for my create tournament button.
View attachment accessforums.zip I hope this attachment works!
The zip above contains 3 images to help show the issue I am having. The database I am working on is for holding local gaming tournaments on the Xbox. I am not worried about brackets and all that, but I am wanting to keep up with members and award points, show entry fees, etc.
I have a create tournament form that I will use to create the actual tournament. In this form I have the Tournament name, Location (which pulls from a different table of just locations), the game we are playing (which pulls from a different table of just games) and the tournament date.
This data will be saved to a table that logs the game id and the location id which are tied to this table with relationships. I can then query later to pull the data like address and all that.
The location and game are both combo boxes which transfers with them the id number which are auto numbers in the original tables, the locations and games tables. The combo box will show you the location name and city state and game will show the console and mature rating.
Thats what is going on, and is working fine, however, what if the location of the tournament dont exist and i want to add it on the fly? Or if the game dont exist and I want to add it on the fly? I added buttons next to these combo boxes that will pull up a form for adding a location. First issue is that the form opens with the first id item in the fields and I want it to be blank for a new location. What is the vba code to do this?
Second problem I am having is this, when i do fill in the add location form and hit save, it adds it to the table as it should, but when i go back to the create tournament form, the data is not in the combo box and i have to hit refresh to do it. I would rather not have to do this but would like the info in that combo box already. I have tinkered with some refresh vba commands (i get cant refresh now or something) and tried some requeries but no luck with either. I can gladly share the database with anyone that needs it to work through. The code below is the code for my create tournament button.
Code:
Private Sub cmdSend_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim varTextData As String
Dim varTextData2 As String
Dim varTextData3 As String
Dim varTextData4 As String
varTextData = LocationBox
varTextData2 = GameBox
varTextData3 = DateBox
varTextData4 = NameBox
Set db = CurrentDb
Set rst = db.OpenRecordset("tblTournaments", dbOpenDynaset)
rst.AddNew
rst!lID = varTextData
rst!gID = varTextData2
rst!tDate = varTextData3
rst!tName = varTextData4
rst.Update
rst.Close
db.Close
Me!LocationBox = ""
Me!GameBox = ""
Me!DateBox = ""
Me!NameBox = ""
End Sub