P
Patsee
I have a simple music dB that contains cd and DVD titles, artist,
recording company and date, all on the main form called Recording, and
the equivalent table.
A sub form and table called Tracks contains the track titles.
I have created a third form for searching the db for title. It is
populated with 26 letter buttons; which when a button is pressed
generate a list of only the album titles that match the corresponding
letter ie if "A" is pressed i get a list of the album titles starting
with A.
If I then double click on the title I'm searching for the Recordings
Main form is then updated.
All done with the use of recordsets and bookmarks.
The problem is that when I need to search for a specific song title on
the subform, I can get the form to load with the alphabetic buttons and
generate the list but on double click I cant get the entry to load both
the mainform with the album tile and the subform with corresponding
song list
Below is the code for the Album DB search
Option Compare Database
Option Explicit
Private Sub Album_Name_DblClick(Cancel As Integer)
'Using a copy(recordset)of list to find selection in Recordings Form _
and load selection.
Dim A As Recordset
Set A = Forms![Recordings].RecordsetClone
A.FindFirst "RecordingTitle = '" & Me![Album Name] & "'"
Forms![Recordings].Bookmark = A.Bookmark
End Sub
Private Sub ButtonFrame_AfterUpdate()
SetListContents
End Sub
Private Sub Form_Load()
'Defines variables used to load labels(caption)on the buttons.
Dim Button
Dim sam
Dim max
'On form load buttons A to Z will be assigned their caption,using _
toggle value of the button and the ASCII chr(), starting at 64.
For Button = 1 To 26
With Me("Toggle" & Button + 1)
.Caption = Chr(Button + 64)
.OptionValue = Button + 64
End With
Next Button
'Buttons for numeric and symbol vaules are loaded starting at ASCII
chr(45) = "."
For sam = 1 To 8
With Me("Toggle3" & sam + 1)
.Caption = Chr(sam + 45)
.OptionValue = sam + 45
End With
Next sam
'Specific button caption load for Toggle40.
With Me("Toggle40")
.Caption = Chr(54)
.OptionValue = 54
End With
'Finish off button caption load, starting at ASCII chr(55).
For max = 0 To 2
With Me("Toggle4" & max + 1)
.Caption = Chr(max + 55)
.OptionValue = max + 55
End With
Next max
Me![ButtonFrame] = 65
SetListContents
End Sub
Sub SetListContents()
'Using SQL to extract entries from FINDIT query that correspond to
button pressed.
Dim SQLtext
SQLtext = "SELECT RecordingTitle FROM FindIt " _
& "WHERE RecordingTitle LIKE '" & Chr(Me![ButtonFrame]) & "*';"
Me![Album Name].RowSource = SQLtext
Me![Album Name].Requery
End Sub
Private Sub Close_Form_Click()
On Error GoTo Err_Close_Form_Click
DoCmd.Close
Exit_Close_Form_Click:
Exit Sub
Err_Close_Form_Click:
MsgBox Err.Description
Resume Exit_Close_Form_Click
End Sub
Any assistance is greatly appreciated
recording company and date, all on the main form called Recording, and
the equivalent table.
A sub form and table called Tracks contains the track titles.
I have created a third form for searching the db for title. It is
populated with 26 letter buttons; which when a button is pressed
generate a list of only the album titles that match the corresponding
letter ie if "A" is pressed i get a list of the album titles starting
with A.
If I then double click on the title I'm searching for the Recordings
Main form is then updated.
All done with the use of recordsets and bookmarks.
The problem is that when I need to search for a specific song title on
the subform, I can get the form to load with the alphabetic buttons and
generate the list but on double click I cant get the entry to load both
the mainform with the album tile and the subform with corresponding
song list
Below is the code for the Album DB search
Option Compare Database
Option Explicit
Private Sub Album_Name_DblClick(Cancel As Integer)
'Using a copy(recordset)of list to find selection in Recordings Form _
and load selection.
Dim A As Recordset
Set A = Forms![Recordings].RecordsetClone
A.FindFirst "RecordingTitle = '" & Me![Album Name] & "'"
Forms![Recordings].Bookmark = A.Bookmark
End Sub
Private Sub ButtonFrame_AfterUpdate()
SetListContents
End Sub
Private Sub Form_Load()
'Defines variables used to load labels(caption)on the buttons.
Dim Button
Dim sam
Dim max
'On form load buttons A to Z will be assigned their caption,using _
toggle value of the button and the ASCII chr(), starting at 64.
For Button = 1 To 26
With Me("Toggle" & Button + 1)
.Caption = Chr(Button + 64)
.OptionValue = Button + 64
End With
Next Button
'Buttons for numeric and symbol vaules are loaded starting at ASCII
chr(45) = "."
For sam = 1 To 8
With Me("Toggle3" & sam + 1)
.Caption = Chr(sam + 45)
.OptionValue = sam + 45
End With
Next sam
'Specific button caption load for Toggle40.
With Me("Toggle40")
.Caption = Chr(54)
.OptionValue = 54
End With
'Finish off button caption load, starting at ASCII chr(55).
For max = 0 To 2
With Me("Toggle4" & max + 1)
.Caption = Chr(max + 55)
.OptionValue = max + 55
End With
Next max
Me![ButtonFrame] = 65
SetListContents
End Sub
Sub SetListContents()
'Using SQL to extract entries from FINDIT query that correspond to
button pressed.
Dim SQLtext
SQLtext = "SELECT RecordingTitle FROM FindIt " _
& "WHERE RecordingTitle LIKE '" & Chr(Me![ButtonFrame]) & "*';"
Me![Album Name].RowSource = SQLtext
Me![Album Name].Requery
End Sub
Private Sub Close_Form_Click()
On Error GoTo Err_Close_Form_Click
DoCmd.Close
Exit_Close_Form_Click:
Exit Sub
Err_Close_Form_Click:
MsgBox Err.Description
Resume Exit_Close_Form_Click
End Sub
Any assistance is greatly appreciated