A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Subform Vs main Form



 
 
Thread Tools Display Modes
  #1  
Old December 2nd, 2005, 06:18 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Subform Vs main Form

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

  #2  
Old December 2nd, 2005, 09:07 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Subform Vs main Form

Did you set the Master/Child relations from the main form to the subform?

It would be better to not have 26 buttons but have a ComboBox with the
AutoExpand property set to Yes. As you type it will scroll to the
corresponding text - example --
Type A - show Ada, Adam, Adanora, etc.
Type AL - show Album, Aldren, Allen, etc.

"Patsee" wrote:

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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form, Subform, Tab key 2nd_Stage_User Using Forms 17 August 25th, 2006 12:30 AM
Need Help In Printing Current Record in Specific Report RNUSZ@OKDPS Setting Up & Running Reports 1 May 16th, 2005 09:06 PM
open a form through a subform in access 2000 Tammy Setting Up & Running Reports 12 October 22nd, 2004 02:43 PM
Filter Problems on Main form & Subform Jeff Using Forms 2 July 7th, 2004 03:13 PM
Filter subform combobox on option button in main form Emma Using Forms 1 June 12th, 2004 12:24 AM


All times are GMT +1. The time now is 09:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.