INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

RecordsetClone No Current Record

RecordsetClone No Current Record

(OP)
I have a form that uses an unbound combobox to select the record displayed. The user box selects a ProjectID and the form shows information about the project. This form has a recordsource that uses a query based on a single table. My code here is working fine.

When I attempt to open the form and pass the project ID to this form, the search in the recordset clone does not find the record. It does populate the combo box. But, if the called form was already open, then the recordset clone does find the record.

I have been unable to figure this one out. Please help



Here is the code:

CODE -->

Public Function OpenMaintainShows(iRecordID As Long) As Boolean
'** I am passing in the Record ID that I want to display on the target form (frmShows_Maintain2)

Dim rs As Object
Dim frm As Form

If IsObjectOpen("frmShows_Maintain2", acForm) Then  '** This calls a function to see if the form is already open
    Forms("frmShows_Maintain2").SetFocus
    Forms("frmShows_Maintain2").cmbShows = iRecordID
        
Else

    DoCmd.OpenForm FormName:="frmShows_Maintain2", View:=acNormal
                   
    Forms("frmShows_Maintain2").cmbShows = iRecordID

End If

'***************************************************************************************************
'** If the target form is open, then this code will work
'** If the target form is closed, the code opens the form, the value in the combo box is updated, but
'** the record is not retrieved
'***************************************************************************************************
Set frm = Forms("frmShows_Maintain2")

Set rs = frm.RecordsetClone
Debug.Print frm.cmbShows.Value
rs.FindFirst "ShowID = " & CInt(frm.cmbShows.Value)
If rs.NoMatch Then
    Debug.Print "did not find record"
Else
    
    frm.Bookmark = rs.Bookmark
End If
End Function 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close