Solved

CBO box not selecting record on subform

Posted on 2008-10-22
13
456 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Search for text in a .txt file 14 46
Access report groups with sums 5 29
backup programme - VBA 3 24
Report with several filters - Issue with query? 3 23
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

821 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