GoToRecord in Subform (1 Viewer)

Matty

...the Myth Buster
Local time
Today, 05:52
Joined
Jun 29, 2001
Messages
396
Hi,

I have a form that displays information about a patient. It includes a listbox showing all their interactions with us (their referral, calls we made to them, etc.). When I double-click on a row in the listbox I have the appropriate form come up based on the description field of the row (i.e. Referral form will come up if it was a row that said "Referral"), and the InteractionID. It works fine for all cases except for one.

To record calls, I have a main form for the patient and a subform to record the calls we make to them. The call records in the subform are the records with the InteractionID. I can get the main patient form to appear, but I want to go to the call record for the InteractionID selected from the listbox.

I thought I could just code Forms![MainFormName]![SubformName].SetFocus and then do a DoCmd.GoToRecord, but with that method, I don't think I can set search criteria.

How else could I go to the call record on the subform with the selected InteractionID?

If it helps, here's what I do to find a record on the other forms:

Code:
strForm = "Sleep - Referral"
strCriteria = "InteractionID = " & Me!lstPatient.Column(0) & ""
DoCmd.OpenForm strForm, , , strCriteria, , , "Sleep - Patient Main Referral"
 
R

Rich

Guest
Dim Rs As String
Rs = Forms!MainForm!ID

DoCmd.RunCommand acCmdSaveRecord
Forms!MainForm!subform.SetFocus
Forms!MainForm!subform!ID.SetFocus
DoCmd.FindRecord Rs
 

Matty

...the Myth Buster
Local time
Today, 05:52
Joined
Jun 29, 2001
Messages
396
Thanx Rich, that worked. I just had to make that InteractionID textbox visible so I could set focus to it, do the find, then make it invisible again.
 
R

Rich

Guest
Just make it miniscule, and then set focus to some other field
 

Users who are viewing this thread

Top Bottom