Please forgive my abuse of the proper terms as it's been a long long time since I've used this knowledge.
I created a database about 10 years ago in MS Access (that I've now managed to update to Access 2016) to help me with keeping track of the songs I was playing at various gigs. It's a pretty simple database, the most complicated part is taking tblSongs, which has all the info about songs (lyrics, author, key, etc.), and sending that over to tblEvents, which links back to tblSongs through a linking table called tblHistLink. If I remember my reasoning correctly, there's a many-to-may relationship between tblSongs and tblEvents, so that's why I needed the linking table.
I have a form, called frmEventInfo, that I use to record the song set I selected in tblSongs into tblEvents.
When I open frmEventInfo, there's a few fields to record the date, category (style of gig), location, etc. Then there's a subform that should display the results of a query I set up called qryService. In tblSongs, there's a checkbox to indicate that a song is "Selected". All qryService does is look at tblSongs and display only the songs where "Selected" is "Yes" (or True).
My issue is that the subform, sfrHistory, is empty whenever I open up frmEventInfo. The Record Source is qryService.
However, if I click the button I created to "submit", the event info does get recorded correctly. It's just that I'd like to see and make sure I'm entering the right songs before I click the button, so having sfrHistory display the songs while I'm entering the other data would be really helpful.
I tried DoCmd.sfrHistory.Requery, attached to a button on the main form, but that didn't work.
I'm sorry if this is a convoluted description. I'd really appreciate your help! Let me know what isn't clear and I'll be happy to explain more.
I'll be back online tomorrow afternoon about 1:00, so forgive me if I don't reply sooner.
Thank you!!
For grins, here's the code that runs the query to add the songs and other info to the event history, in case this makes any more sense. I have to admit that I do not understand the comments. I think that was a carryover from another project...
Thanks!!
Matt
I created a database about 10 years ago in MS Access (that I've now managed to update to Access 2016) to help me with keeping track of the songs I was playing at various gigs. It's a pretty simple database, the most complicated part is taking tblSongs, which has all the info about songs (lyrics, author, key, etc.), and sending that over to tblEvents, which links back to tblSongs through a linking table called tblHistLink. If I remember my reasoning correctly, there's a many-to-may relationship between tblSongs and tblEvents, so that's why I needed the linking table.
I have a form, called frmEventInfo, that I use to record the song set I selected in tblSongs into tblEvents.
When I open frmEventInfo, there's a few fields to record the date, category (style of gig), location, etc. Then there's a subform that should display the results of a query I set up called qryService. In tblSongs, there's a checkbox to indicate that a song is "Selected". All qryService does is look at tblSongs and display only the songs where "Selected" is "Yes" (or True).
My issue is that the subform, sfrHistory, is empty whenever I open up frmEventInfo. The Record Source is qryService.
However, if I click the button I created to "submit", the event info does get recorded correctly. It's just that I'd like to see and make sure I'm entering the right songs before I click the button, so having sfrHistory display the songs while I'm entering the other data would be really helpful.
I tried DoCmd.sfrHistory.Requery, attached to a button on the main form, but that didn't work.
I'm sorry if this is a convoluted description. I'd really appreciate your help! Let me know what isn't clear and I'll be happy to explain more.
I'll be back online tomorrow afternoon about 1:00, so forgive me if I don't reply sooner.
Thank you!!
For grins, here's the code that runs the query to add the songs and other info to the event history, in case this makes any more sense. I have to admit that I do not understand the comments. I think that was a carryover from another project...
Code:
Private Sub cmdAddEventSongs_Click()
On Error GoTo Err_cmdAddEventSongs_Click
Dim stDocName As String
Dim intResponse As Integer
'Prevent errors from when you save the edited expanded glossary
'Otherwise you will lose your edits to the 'code' window if you
'make changes to it and then change the expanded glossary
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
'Turn the warnings off
DoCmd.SetWarnings False
stDocName = "qryAddEventSongs"
DoCmd.OpenQuery stDocName, acNormal, acEdit
intResponse = MsgBox("Record Addition Successful!" & Chr$(13) & Chr$(10) & _
"Would you like to deselect the current SongList?", vbYesNo)
If intResponse = vbYes Then
DoCmd.OpenQuery "qryResetSelected"
DoCmd.OpenQuery "qryResetOrder"
DoCmd.Requery
DoCmd.GoToRecord , , acLast
End If
'Turn the warnings back on
DoCmd.SetWarnings True
Exit_cmdAddEventSongs_Click:
Exit Sub
Err_cmdAddEventSongs_Click:
MsgBox Err.Description
Resume Exit_cmdAddEventSongs_Click
End Sub
Thanks!!
Matt