Problem retrieving data from a subform

A

Alejandro

Hello there,

I’m working on an application that will be used to register people. The app
is somewhat complicated so first I’ll explain what the app does (or is
supposed to do) and then I’ll explain what the problem is.

The registration process is performed in two steps, each step being done at
a different physical location (in the first location a new record is created
but it is incomplete; in the second location they pull that record and finish
the registration). So I created one form per location, each one with a
subform in it. The two forms and two subforms are all linked to the same main
table that keeps all the records. The subforms are meant to show the
incomplete records (records entered the current date where a specific field
is null) and they are updated every time the parent forms are loaded, when a
new record is saved, or when the user clicks on an Update button in the
forms. This is the code line that I used for that:

Me.sfrm_OP_Pts_Queue_Or_InProcess.Requery

So this is the way it works: the user in location 1 opens form 1 and enters
a person’s information (not all the fields, though). Then she clicks on the
Save button and the incomplete record is shown in the subform. In location 2
another user opens form 2 and since subforms in forms 1 and 2 have the same
structure she also sees the incomplete record in the subform of form 2. By
double-clicking on the Name field of that subform she loads that record into
the main form, then she completes the registration, clicks on the Save
button, and the record disappears from the subform (since the subform only
shows incomplete records). To load the record shown in the subform into the
main form I use this code (using the Double-Click event in the textbox of the
subform that shows people’s names):

Private Sub PATIENT_NAME_DblClick(Cancel As Integer)
Dim SelectedPatient As Recordset, Criteria As String
Set SelectedPatient = Me.RecordsetClone
Criteria = Me.[PATIENT_ID]
Parent!PATIENT_ID.Visible = True
Parent!PATIENT_ID.SetFocus
DoCmd.FindRecord Criteria
Parent![ADMITTING FINISH TIME].SetFocus
Parent!PATIENT_ID.Visible = False

End Sub

Now, this is the issue: if there are several accounts that have been entered
in location 1 and the user in location 2 opens form 2, all those accounts are
shown in the subform and the user can double-click on each one of them and
they’ll pop up in the main form without a problem. But, if additional
accounts are entered while form 2 is open and the user in location 2 uses the
Update button to update the subform (instead of closing form 2 and loading it
again) then although the subform is updated the code to load the new records
into the main form doesn’t work. I can’t get the record to upload in the main
form when I double-click on the name of the person, never mind that I’m using
the same code line for both events (loading the form and clicking on the
update button).

I hope I made myself clear, and that someone out there knows what could be
wrong with my app. Thanks in avance!

AP.
 
A

Alejandro

It's been almost a month since I posted this. If I didn't make myself clear
with my question please do let me know but I really need help with this
problem.

Thanks.


Alejandro said:
Hello there,

I’m working on an application that will be used to register people. The app
is somewhat complicated so first I’ll explain what the app does (or is
supposed to do) and then I’ll explain what the problem is.

The registration process is performed in two steps, each step being done at
a different physical location (in the first location a new record is created
but it is incomplete; in the second location they pull that record and finish
the registration). So I created one form per location, each one with a
subform in it. The two forms and two subforms are all linked to the same main
table that keeps all the records. The subforms are meant to show the
incomplete records (records entered the current date where a specific field
is null) and they are updated every time the parent forms are loaded, when a
new record is saved, or when the user clicks on an Update button in the
forms. This is the code line that I used for that:

Me.sfrm_OP_Pts_Queue_Or_InProcess.Requery

So this is the way it works: the user in location 1 opens form 1 and enters
a person’s information (not all the fields, though). Then she clicks on the
Save button and the incomplete record is shown in the subform. In location 2
another user opens form 2 and since subforms in forms 1 and 2 have the same
structure she also sees the incomplete record in the subform of form 2. By
double-clicking on the Name field of that subform she loads that record into
the main form, then she completes the registration, clicks on the Save
button, and the record disappears from the subform (since the subform only
shows incomplete records). To load the record shown in the subform into the
main form I use this code (using the Double-Click event in the textbox of the
subform that shows people’s names):

Private Sub PATIENT_NAME_DblClick(Cancel As Integer)
Dim SelectedPatient As Recordset, Criteria As String
Set SelectedPatient = Me.RecordsetClone
Criteria = Me.[PATIENT_ID]
Parent!PATIENT_ID.Visible = True
Parent!PATIENT_ID.SetFocus
DoCmd.FindRecord Criteria
Parent![ADMITTING FINISH TIME].SetFocus
Parent!PATIENT_ID.Visible = False

End Sub

Now, this is the issue: if there are several accounts that have been entered
in location 1 and the user in location 2 opens form 2, all those accounts are
shown in the subform and the user can double-click on each one of them and
they’ll pop up in the main form without a problem. But, if additional
accounts are entered while form 2 is open and the user in location 2 uses the
Update button to update the subform (instead of closing form 2 and loading it
again) then although the subform is updated the code to load the new records
into the main form doesn’t work. I can’t get the record to upload in the main
form when I double-click on the name of the person, never mind that I’m using
the same code line for both events (loading the form and clicking on the
update button).

I hope I made myself clear, and that someone out there knows what could be
wrong with my app. Thanks in avance!

AP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top