Solved

CBO box not selecting record on subform

Posted on 2008-10-22
13
457 Views
Last Modified: 2013-11-25
I am tring to get a subform to go to the correct record when I change the value in a cbo box, but not happening.
Private Sub cboBranchNo_Click()
Dim rst As Recordset
Dim strSearchName As String, strFormName As String
strFormName = Me.Name
    Set rst = Me.sfmAMLItems.RecordsetClone
    strSearchName = Str(Me!cboBranchNo)
    rst.FindFirst "BR_NMR = " & strSearchName
        If rst.NoMatch Then
            MsgBox "Record not found"
        Else
            Me.Bookmark = rst.Bookmark
        End If
    rst.Close
 
End Sub

Open in new window

0
Comment
Question by:ssmith94015
  • 8
  • 5
13 Comments
 
LVL 75
ID: 22781932


Private Sub cboBranchNo_Click()
Dim rst As Recordset
Dim strSearchName As String, strFormName As String
strFormName = Me.Name
    Set rst = Me.sfmAMLItems.RecordsetClone
    strSearchName = Str(Me!cboBranchNo)
    rst.FindFirst "BR_NMR = " & Chr(34) & strSearchName & Chr(34)   ' ** change here
        If rst.NoMatch Then
            MsgBox "Record not found"
        Else
            Me.Bookmark = rst.Bookmark
        End If
    rst.Close
 
End Sub
0
 

Author Comment

by:ssmith94015
ID: 22781963
The main form is not recogniing the exitance of the subform  I get Method or data member not found.
0
 

Author Comment

by:ssmith94015
ID: 22781968
I also moved it to the after update event
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 22781995
Private Sub cboBranchNo_Click()
Dim rst As Recordset
Dim strSearchName As String, strFormName As String
strFormName = Me.Name
    Set rst = Me.sfmAMLItems.Form.RecordsetClone           ' * change here also
    strSearchName = Str(Me!cboBranchNo)
    rst.FindFirst "BR_NMR = " & Chr(34) & strSearchName & Chr(34)   ' ** change here
        If rst.NoMatch Then
            MsgBox "Record not found"
        Else
            Me.Bookmark = rst.Bookmark
        End If
    rst.Close
 
End Sub
0
 
LVL 75
ID: 22781997
Is this code on the Main form ?

mx
0
 

Author Comment

by:ssmith94015
ID: 22782027
Yes. The main form is an unbound form with only two controls, the combo box to select the records and a text box that holds an email address where the reocrds will be sent.
0
 

Author Comment

by:ssmith94015
ID: 22782039
I have to sign off until tomorrow.  Will come back to this issue then,.
0
 
LVL 75
ID: 22782045
Did you make the change from my last post?

Set rst = Me.sfmAMLItems.Form.RecordsetClone           ' * change here also

                                     -----^^^^^-------  add the Form object

mx
0
 

Author Comment

by:ssmith94015
ID: 22789162
I think, with you help, I figured it out.  Could it be that the combo box is unbound and the sub-form does not really have a relationship with the "main" form?  I played with it a little this morning, deleted the sub-form and recreated it.  I got the wizrd box asking me for the relationsihp and when I selected to define my own, the only control from the main form was the email address box, the combo did not appear as a selection.  I think that it the main issue and I need to redesign the form.  What I am trying to do is have the user distiall the rows in the subform to those that need to go to a partricular branch, so I need to have the combo box's data source a distince list of the branch numbers rather than what I have now.  I need to re-design the underlying tables to connect the detail rows with the e-mail addresses via the branch numbers.
0
 
LVL 75
ID: 22789219
"Could it be that the combo box is unbound and the sub-form does not really have a relationship with the "main" form?"

Ummm ... I don't think so.  That would not matter.  It's something else.

mx
0
 

Author Comment

by:ssmith94015
ID: 22789253
AAARRGGG, I would hoping that was it.  Problem now is I have been pulled onto another issue and cannot get back to this until tomorrow again.
0
 

Author Comment

by:ssmith94015
ID: 22800168
I give up. sometihng to (#^^& smple and I can't get it to work.  It looks fine, looks like other things I have done, but refuses to cooperate and I am losing patience.  But your suggestion did work as I have used them in other places, I don't know why and I don't have the time to devote to it.  I will have to think of something else.  

Thanks for trying to help.
0
 

Author Closing Comment

by:ssmith94015
ID: 31508999
DatabaseMX, thank for trying to help.  I don't know what theheck is wrong but I have to work around it to get this out the door.  It is sucha  simple thing but just won't work.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question