Problem retrieving record

vX987

Registered User.
Local time
Today, 02:52
Joined
Jun 29, 2007
Messages
51
Hi. I have a search form for patients. Once I find the patient I need, there's a command button that would direct me to their record on a different form. The problem is that when I click on the button and open the form containing the record for that patient, the form only contains that one patient's record.... meaning, it is only displaying record 1 of 1, when in reality I have 100+ other patients. I want it where the command would open up to the patient I'm specifically looking for but still allow me to use the navigation buttons to navigate through other patients. Here's is the code I currently have for the cmd button On Click:

Code:
On Error GoTo Err_OpenFRM_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "MAINfrm"
    
    stLinkCriteria = "[MRN]=" & "'" & Me![MRN] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.Close acForm, "FINDPatient"

Exit_OpenFRM_Click:
    Exit Sub

Err_OpenFRM_Click:
    MsgBox Err.Description
    Resume Exit_OpenFRM_Click
 
Try

Code:
  Dim rs               As Object
  DoCmd.OpenForm "MAINfrm"
  Set rs = Forms!MAINfrm.RecordsetClone

  rs.FindFirst "[MRN]='" & Me![MRN] & "'"

  Forms!MAINfrm.Bookmark = rs.Bookmark

  DoCmd.Close acForm, "FINDPatient"
  
  Set rs = Nothing
 
It works wonderful!! Thank you Paul!
 

Users who are viewing this thread

Back
Top Bottom