Pass selection from popup form listbox to record on continuous subform

K

kheisler6

I have a main form (frmPatients) with a subform (fsubReferrals), with a
subform (fsubPeople).

For each referral, the user uses a continuous subform to add people
related to the referral. To do this, I would like the user to:

1. Click an "Add Person to Referral" button on a new record in the
subform

2. Have a popup box appear which allows him to first search (by last
name) to see if the person exists (everyone in tblPeople is listed in a
listbox on the popup form).

...... 2a. If he finds the person, I'd like him to be able to
highlight the name, hit a "Select" button on the popup, and have
that person passed to the appropriate record on the subform.

...... 2b. If he doesn't find the person, I'd like him to click an
"Add New Person" button on the popup, enter info about the new
person, and then have that person passed to the appropriate record on
the subform.

A combo box with NotInList code could to do this, but the popup box
approach will allow me to add some additional features and options for
the user.

Every thing works up to the point when - if he finds the person
he's looking for in the popup search box and hits the Select button
- it says "Person Not Found" (part of my code)

Every thing is modeled after the nifty ExpandingSearch2K download
available at http://www.datastrat.com/Download2.html.

Thanks for any advice. - Kurt

CODE BELOW:

Code for "Add Person to Referral" button (a button on each record
of the continuous subform, fsubPeople):

Private Sub cmdAddPersonToReferral_Click()

Dim lngPersonID As Long
lngPersonID = GetPersonID 'GetPersonID is a public function,
listed below

If lngPersonID <> 0 Then

Dim rs As Recordset
Dim db As Database
Dim criteria As String

Set db = CurrentDb()
Set rs = Me.RecordsetClone
criteria = "[PersonID] =" & lngPersonID
rs.FindFirst criteria

If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "Person Not Found"
End If
Me.Refresh

End If

rs.Close
db.Close
Set rs = Nothing
Set db = Nothing

Exit Sub
End Sub

-----------------------------------------------------------------

Public Function GetPersonID() As Long

lngPersonIDSelect = 0
DoCmd.OpenForm "frmAddPeopleToReferral" 'This is the popup box
Do While lngPersonIDSelect = 0
DoEvents
Loop
If lngPersonIDSelect = -1 Then
lngPersonIDSelect = 0
End If
GetPersonID2 = lngPersonIDSelect
Exit Function

End Function

-----------------------------------------------------------------

Code for "Select" button on popup form, after user has highlighted
the name

If Not IsNull(Me![lstResults].Column(0)) Then
lngPersonIDSelect = Me![lstResults].Column(0)
DoCmd.Close

Else
MsgBox "Select a name or press cancel."
End If
Exit Sub

End Sub
 
G

Guest

so how is the *select* code executing the cmdAddPersonToReferall_Click
coding that produces the reply "Person Not Found"?

Do you have the same code elsewhere in either forms got_focus, lost_focus
exit close events or anything that is happening between pressing cancel and
the message coming up?

does the pop up close 1st?

and lastly have you put a code stop in to watch where the error is happening
and followed it all the way thru?

TonyT..

I have a main form (frmPatients) with a subform (fsubReferrals), with a
subform (fsubPeople).

For each referral, the user uses a continuous subform to add people
related to the referral. To do this, I would like the user to:

1. Click an "Add Person to Referral" button on a new record in the
subform

2. Have a popup box appear which allows him to first search (by last
name) to see if the person exists (everyone in tblPeople is listed in a
listbox on the popup form).

...... 2a. If he finds the person, I'd like him to be able to
highlight the name, hit a "Select" button on the popup, and have
that person passed to the appropriate record on the subform.

...... 2b. If he doesn't find the person, I'd like him to click an
"Add New Person" button on the popup, enter info about the new
person, and then have that person passed to the appropriate record on
the subform.

A combo box with NotInList code could to do this, but the popup box
approach will allow me to add some additional features and options for
the user.

Every thing works up to the point when - if he finds the person
he's looking for in the popup search box and hits the Select button
- it says "Person Not Found" (part of my code)

Every thing is modeled after the nifty ExpandingSearch2K download
available at http://www.datastrat.com/Download2.html.

Thanks for any advice. - Kurt

CODE BELOW:

Code for "Add Person to Referral" button (a button on each record
of the continuous subform, fsubPeople):

Private Sub cmdAddPersonToReferral_Click()

Dim lngPersonID As Long
lngPersonID = GetPersonID 'GetPersonID is a public function,
listed below

If lngPersonID <> 0 Then

Dim rs As Recordset
Dim db As Database
Dim criteria As String

Set db = CurrentDb()
Set rs = Me.RecordsetClone
criteria = "[PersonID] =" & lngPersonID
rs.FindFirst criteria

If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "Person Not Found"
End If
Me.Refresh

End If

rs.Close
db.Close
Set rs = Nothing
Set db = Nothing

Exit Sub
End Sub

-----------------------------------------------------------------

Public Function GetPersonID() As Long

lngPersonIDSelect = 0
DoCmd.OpenForm "frmAddPeopleToReferral" 'This is the popup box
Do While lngPersonIDSelect = 0
DoEvents
Loop
If lngPersonIDSelect = -1 Then
lngPersonIDSelect = 0
End If
GetPersonID2 = lngPersonIDSelect
Exit Function

End Function

-----------------------------------------------------------------

Code for "Select" button on popup form, after user has highlighted
the name

If Not IsNull(Me![lstResults].Column(0)) Then
lngPersonIDSelect = Me![lstResults].Column(0)
DoCmd.Close

Else
MsgBox "Select a name or press cancel."
End If
Exit Sub

End Sub
 
K

kheisler6

I should point out that the popup box feature works perfectly on my
main form, where a user uses it to search for and select a person,
whose record is then brought up. This was its intended use in the
ExpandingSearch2K download available at
http://www.datastrat.com/Download2.html.

But something breaks down when trying to use it to pull up a record in
a subform. I suspect it's related to the issue of bookmarking a record
in a continuous form.
so how is the *select* code executing the cmdAddPersonToReferall_Click
coding that produces the reply "Person Not Found"?

As I interpret it (and this could be wrong, but the process works on
the main form):

The cmdAddPersonToReferral button sets lngPersonID = GetPersonID. It
does this by first calling the function, GetPersonID, which sets
GetPersonID = lngPersonIDSelect.

So, by the time the user presses the Select button, the Select button
code looks for the value of lngPersonIDSelect, which has been set to =
lngPersonID in the previous step. So, in the cmdAddPersonToReferral
code (which is still running):
criteria = "[PersonID] =" & lngPersonID
rs.FindFirst criteria
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "Person Not Found"
End If
Me.Refresh

Somehow, though, it's not getting bookmarked correctly. Access thinks
it doesn't find a match and jumps to the Else statement, "Person Not
Found".
Do you have the same code elsewhere in either forms got_focus, lost_focus
exit close events or anything that is happening between pressing cancel and
the message coming up?
No.

does the pop up close 1st?

Yes. The code behind the "Select" button tells it to close as long as a
person is selected (i.e., If NotIsNull).
and lastly have you put a code stop in to watch where the error is happening
and followed it all the way thru?

I haven't, because I doubt it will find a true error. The message
"Person not found" isn't part of any error handling, it's part of an If
Then statement. Also, I have error handling in all of my code (I just
didn't include it in this post), and it's not catching anything.

Any ideas?
TonyT..

I have a main form (frmPatients) with a subform (fsubReferrals), with a
subform (fsubPeople).

For each referral, the user uses a continuous subform to add people
related to the referral. To do this, I would like the user to:

1. Click an "Add Person to Referral" button on a new record in the
subform

2. Have a popup box appear which allows him to first search (by last
name) to see if the person exists (everyone in tblPeople is listed in a
listbox on the popup form).

...... 2a. If he finds the person, I'd like him to be able to
highlight the name, hit a "Select" button on the popup, and have
that person passed to the appropriate record on the subform.

...... 2b. If he doesn't find the person, I'd like him to click an
"Add New Person" button on the popup, enter info about the new
person, and then have that person passed to the appropriate record on
the subform.

A combo box with NotInList code could to do this, but the popup box
approach will allow me to add some additional features and options for
the user.

Every thing works up to the point when - if he finds the person
he's looking for in the popup search box and hits the Select button
- it says "Person Not Found" (part of my code)

Every thing is modeled after the nifty ExpandingSearch2K download
available at http://www.datastrat.com/Download2.html.

Thanks for any advice. - Kurt

CODE BELOW:

Code for "Add Person to Referral" button (a button on each record
of the continuous subform, fsubPeople):

Private Sub cmdAddPersonToReferral_Click()

Dim lngPersonID As Long
lngPersonID = GetPersonID 'GetPersonID is a public function,
listed below

If lngPersonID <> 0 Then

Dim rs As Recordset
Dim db As Database
Dim criteria As String

Set db = CurrentDb()
Set rs = Me.RecordsetClone
criteria = "[PersonID] =" & lngPersonID
rs.FindFirst criteria

If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "Person Not Found"
End If
Me.Refresh

End If

rs.Close
db.Close
Set rs = Nothing
Set db = Nothing

Exit Sub
End Sub

-----------------------------------------------------------------

Public Function GetPersonID() As Long

lngPersonIDSelect = 0
DoCmd.OpenForm "frmAddPeopleToReferral" 'This is the popup box
Do While lngPersonIDSelect = 0
DoEvents
Loop
If lngPersonIDSelect = -1 Then
lngPersonIDSelect = 0
End If
GetPersonID = lngPersonIDSelect
Exit Function

End Function

-----------------------------------------------------------------

Code for "Select" button on popup form, after user has highlighted
the name

If Not IsNull(Me![lstResults].Column(0)) Then
lngPersonIDSelect = Me![lstResults].Column(0)
DoCmd.Close

Else
MsgBox "Select a name or press cancel."
End If
Exit Sub

End Sub
 
G

Guest

Ok I'm confused now,
is lstResults a listbox on the pop-up form? i'm guessing it has to be
otherwise the code seems redundant, that would mean;
If Not IsNull(Me![lstResults].Column(0)) Then
lngPersonIDSelect = Me![lstResults].Column(0)
DoCmd.Close

Else
MsgBox "Select a name or press cancel."
End If
Exit Sub

the above code is in the On_Click event of your button named 'Select'? am i
correct so far?

If that is the only code in the On_Click event, the pressing of it, and the
running of the above code, in itself cannot call
cmdAddPersonToReferral_Click()
the only place you say that contains the words "Person Not Found", so like
you say that must still be running, and the function must therefore give it a
value thru GetPersonID, which must be "0" or not equal to a value in your
selected recordsetclone, if you toggle a breakpoint at rs.finfirst criteria,
and check that, then follow the code you should see if it's the function
calling and returning data outside your current recordset (re-establish your
recordset again beforehand) or the function not finding the data in the 1st
place. The bookmark itself can't be the problem because the If Not rs.NoMatch
*MUST* evaluate to False to get to the Else part of the statement, just
because it doesn't like something in the *TRUE* part, it won't carry on into
the *False* part.

Not exactly ans answer yet I'm afraid, but hopefully leading in that
direction :p

TonyT..

I should point out that the popup box feature works perfectly on my
main form, where a user uses it to search for and select a person,
whose record is then brought up. This was its intended use in the
ExpandingSearch2K download available at
http://www.datastrat.com/Download2.html.

But something breaks down when trying to use it to pull up a record in
a subform. I suspect it's related to the issue of bookmarking a record
in a continuous form.
so how is the *select* code executing the cmdAddPersonToReferall_Click
coding that produces the reply "Person Not Found"?

As I interpret it (and this could be wrong, but the process works on
the main form):

The cmdAddPersonToReferral button sets lngPersonID = GetPersonID. It
does this by first calling the function, GetPersonID, which sets
GetPersonID = lngPersonIDSelect.

So, by the time the user presses the Select button, the Select button
code looks for the value of lngPersonIDSelect, which has been set to =
lngPersonID in the previous step. So, in the cmdAddPersonToReferral
code (which is still running):
criteria = "[PersonID] =" & lngPersonID
rs.FindFirst criteria
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "Person Not Found"
End If
Me.Refresh

Somehow, though, it's not getting bookmarked correctly. Access thinks
it doesn't find a match and jumps to the Else statement, "Person Not
Found".
Do you have the same code elsewhere in either forms got_focus, lost_focus
exit close events or anything that is happening between pressing cancel and
the message coming up?
No.

does the pop up close 1st?

Yes. The code behind the "Select" button tells it to close as long as a
person is selected (i.e., If NotIsNull).
and lastly have you put a code stop in to watch where the error is happening
and followed it all the way thru?

I haven't, because I doubt it will find a true error. The message
"Person not found" isn't part of any error handling, it's part of an If
Then statement. Also, I have error handling in all of my code (I just
didn't include it in this post), and it's not catching anything.

Any ideas?
TonyT..

I have a main form (frmPatients) with a subform (fsubReferrals), with a
subform (fsubPeople).

For each referral, the user uses a continuous subform to add people
related to the referral. To do this, I would like the user to:

1. Click an "Add Person to Referral" button on a new record in the
subform

2. Have a popup box appear which allows him to first search (by last
name) to see if the person exists (everyone in tblPeople is listed in a
listbox on the popup form).

...... 2a. If he finds the person, I'd like him to be able to
highlight the name, hit a "Select" button on the popup, and have
that person passed to the appropriate record on the subform.

...... 2b. If he doesn't find the person, I'd like him to click an
"Add New Person" button on the popup, enter info about the new
person, and then have that person passed to the appropriate record on
the subform.

A combo box with NotInList code could to do this, but the popup box
approach will allow me to add some additional features and options for
the user.

Every thing works up to the point when - if he finds the person
he's looking for in the popup search box and hits the Select button
- it says "Person Not Found" (part of my code)

Every thing is modeled after the nifty ExpandingSearch2K download
available at http://www.datastrat.com/Download2.html.

Thanks for any advice. - Kurt

CODE BELOW:

Code for "Add Person to Referral" button (a button on each record
of the continuous subform, fsubPeople):

Private Sub cmdAddPersonToReferral_Click()

Dim lngPersonID As Long
lngPersonID = GetPersonID 'GetPersonID is a public function,
listed below

If lngPersonID <> 0 Then

Dim rs As Recordset
Dim db As Database
Dim criteria As String

Set db = CurrentDb()
Set rs = Me.RecordsetClone
criteria = "[PersonID] =" & lngPersonID
rs.FindFirst criteria

If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "Person Not Found"
End If
Me.Refresh

End If

rs.Close
db.Close
Set rs = Nothing
Set db = Nothing

Exit Sub
End Sub

-----------------------------------------------------------------

Public Function GetPersonID() As Long

lngPersonIDSelect = 0
DoCmd.OpenForm "frmAddPeopleToReferral" 'This is the popup box
Do While lngPersonIDSelect = 0
DoEvents
Loop
If lngPersonIDSelect = -1 Then
lngPersonIDSelect = 0
End If
GetPersonID = lngPersonIDSelect
Exit Function

End Function

-----------------------------------------------------------------

Code for "Select" button on popup form, after user has highlighted
the name

If Not IsNull(Me![lstResults].Column(0)) Then
lngPersonIDSelect = Me![lstResults].Column(0)
DoCmd.Close

Else
MsgBox "Select a name or press cancel."
End If
Exit Sub

End Sub
 
K

kheisler6

is lstResults a listbox on the pop-up form?

Yes.
... that would mean;
If Not IsNull(Me![lstResults].Column(0)) Then
lngPersonIDSelect = Me![lstResults].Column(0)
DoCmd.Close
Else
MsgBox "Select a name or press cancel."
End If
Exit Sub

the above code is in the On_Click event of your button named 'Select'? am i
correct so far?
Yes.

If that is the only code in the On_Click event

It is.
if you toggle a breakpoint at rs.finfirst criteria,
and check that, then follow the code you should see if it's the function
calling and returning data outside your current recordset (re-establish your
recordset again beforehand) or the function not finding the data in the 1st
place.

I'm not very familiar with how to use breakpoints, so I may have done
this wrong: I toggled a breakpoint at rs.FindFirst criteria. I then
closed the VB window and tried to add a new person to the referral. I
hit "Add Person To Referral" button, the popup box appeared, I searched
for and then highlighted a person in the list box, and hit "Select."
When I hit Select, the VB screen opened up and the rs.FindFirst
criteria was highlighted. What do I do now? I hit Step Into (the Else
line was highlighted), then Step Into again (the MsgBox "Person Not
Found" line was highlighted), then Step Into again (the End If line was
highlighted and the focus was brought to the form view and the "Person
Not Found" message popped up.

I'm not sure how to interpret this or if I did it right.

Here's something else I did. In the original ExpandedSearch2k download,
I made their main form (which had the Add Person button) into a subform
(and linked it to a new main form with a new parent table I created
with some fake data). Now that the Add Person button is on a subform,
the same problem occurred: The popup box appeared, I highlighted a
person and hit Select: "Person Not Found."

Perhaps my problem is something as simple as the subform not properaly
being referenced when the focus is on the popup box?

Thanks for your continued help.

Kurt
I should point out that the popup box feature works perfectly on my
main form, where a user uses it to search for and select a person,
whose record is then brought up. This was its intended use in the
ExpandingSearch2K download available at
http://www.datastrat.com/Download2.html.

But something breaks down when trying to use it to pull up a record in
a subform. I suspect it's related to the issue of bookmarking a record
in a continuous form.
so how is the *select* code executing the cmdAddPersonToReferall_Click
coding that produces the reply "Person Not Found"?

As I interpret it (and this could be wrong, but the process works on
the main form):

The cmdAddPersonToReferral button sets lngPersonID = GetPersonID. It
does this by first calling the function, GetPersonID, which sets
GetPersonID = lngPersonIDSelect.

So, by the time the user presses the Select button, the Select button
code looks for the value of lngPersonIDSelect, which has been set to =
lngPersonID in the previous step. So, in the cmdAddPersonToReferral
code (which is still running):
criteria = "[PersonID] =" & lngPersonID
rs.FindFirst criteria
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "Person Not Found"
End If
Me.Refresh

Somehow, though, it's not getting bookmarked correctly. Access thinks
it doesn't find a match and jumps to the Else statement, "Person Not
Found".
Do you have the same code elsewhere in either forms got_focus, lost_focus
exit close events or anything that is happening between pressing cancel and
the message coming up?
No.

does the pop up close 1st?

Yes. The code behind the "Select" button tells it to close as long as a
person is selected (i.e., If NotIsNull).
and lastly have you put a code stop in to watch where the error is happening
and followed it all the way thru?

I haven't, because I doubt it will find a true error. The message
"Person not found" isn't part of any error handling, it's part of an If
Then statement. Also, I have error handling in all of my code (I just
didn't include it in this post), and it's not catching anything.

Any ideas?
TonyT..

:

I have a main form (frmPatients) with a subform (fsubReferrals), with a
subform (fsubPeople).

For each referral, the user uses a continuous subform to add people
related to the referral. To do this, I would like the user to:

1. Click an "Add Person to Referral" button on a new record in the
subform

2. Have a popup box appear which allows him to first search (by last
name) to see if the person exists (everyone in tblPeople is listed in a
listbox on the popup form).

...... 2a. If he finds the person, I'd like him to be able to
highlight the name, hit a "Select" button on the popup, and have
that person passed to the appropriate record on the subform.

...... 2b. If he doesn't find the person, I'd like him to click an
"Add New Person" button on the popup, enter info about the new
person, and then have that person passed to the appropriate record on
the subform.

A combo box with NotInList code could to do this, but the popup box
approach will allow me to add some additional features and options for
the user.

Every thing works up to the point when - if he finds the person
he's looking for in the popup search box and hits the Select button
- it says "Person Not Found" (part of my code)

Every thing is modeled after the nifty ExpandingSearch2K download
available at http://www.datastrat.com/Download2.html.

Thanks for any advice. - Kurt

CODE BELOW:

Code for "Add Person to Referral" button (a button on each record
of the continuous subform, fsubPeople):

Private Sub cmdAddPersonToReferral_Click()

Dim lngPersonID As Long
lngPersonID = GetPersonID 'GetPersonID is a public function,
listed below

If lngPersonID <> 0 Then

Dim rs As Recordset
Dim db As Database
Dim criteria As String

Set db = CurrentDb()
Set rs = Me.RecordsetClone
criteria = "[PersonID] =" & lngPersonID
rs.FindFirst criteria

If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "Person Not Found"
End If
Me.Refresh

End If

rs.Close
db.Close
Set rs = Nothing
Set db = Nothing

Exit Sub
End Sub

-----------------------------------------------------------------

Public Function GetPersonID() As Long

lngPersonIDSelect = 0
DoCmd.OpenForm "frmAddPeopleToReferral" 'This is the popup box
Do While lngPersonIDSelect = 0
DoEvents
Loop
If lngPersonIDSelect = -1 Then
lngPersonIDSelect = 0
End If
GetPersonID = lngPersonIDSelect
Exit Function

End Function

-----------------------------------------------------------------

Code for "Select" button on popup form, after user has highlighted
the name

If Not IsNull(Me![lstResults].Column(0)) Then
lngPersonIDSelect = Me![lstResults].Column(0)
DoCmd.Close

Else
MsgBox "Select a name or press cancel."
End If
Exit Sub

End Sub
 
G

Guest

I'm not very familiar with how to use breakpoints, so I may have done
this wrong: I toggled a breakpoint at rs.FindFirst criteria. I then
closed the VB window and tried to add a new person to the referral. I
hit "Add Person To Referral" button, the popup box appeared, I searched
for and then highlighted a person in the list box, and hit "Select."
When I hit Select, the VB screen opened up and the rs.FindFirst
criteria was highlighted. What do I do now? I hit Step Into (the Else
line was highlighted), then Step Into again (the MsgBox "Person Not
Found" line was highlighted), then Step Into again (the End If line was
highlighted and the focus was brought to the form view and the "Person
Not Found" message popped up.

Correct useage of a breakpoint, F8 steps thru code line by line save keep
mouse clicking, if you then hover the mouse over each variable / control as
the code approaches *AND* passes you will see as variables get set and
change, if the mouse mouse hover bit doesn't work open then vba immediate
window and type in "?" without the quotes and then the variable / sql
statement etc (eg ? rs.FindFirst criteria after code has passed by 1 line).

My guess is, however, that your pop-up form is an unbound form with only the
listbox having a row/recordsource, in which case the me.RecordestClone has no
recordset TO clone (hover mouse over Set rs = .. to test) as the 2 codes are
then running simultaneously so the me. part is still referring to the pop-up.
Try [forms].[MainformName].[fsubPeople].RecordsetClone instead of me. - check
form and subform names.

You have found a good reason for not putting in error handling *until* you
know all the code is working 1st :p

Keep going you getting closer i think.

TonyT..
 
K

kheisler6

I tried editing the code in several ways to properly reference the
subform but the problem remains.
Keep going you getting closer i think.

So close ... so close.

You can download a simplified mockup of the issue here:

http://sendit.evms.edu/dl.php?key=fcf7d4acf721c8e893cf3c88349d5205

This one just involves a main form and a subform (as opposed to my
situtation which is a main form, subform, and subsubform), but you can
easily replicate the problem.

I'll keep hammering at this ...

Kurt
I'm not very familiar with how to use breakpoints, so I may have done
this wrong: I toggled a breakpoint at rs.FindFirst criteria. I then
closed the VB window and tried to add a new person to the referral. I
hit "Add Person To Referral" button, the popup box appeared, I searched
for and then highlighted a person in the list box, and hit "Select."
When I hit Select, the VB screen opened up and the rs.FindFirst
criteria was highlighted. What do I do now? I hit Step Into (the Else
line was highlighted), then Step Into again (the MsgBox "Person Not
Found" line was highlighted), then Step Into again (the End If line was
highlighted and the focus was brought to the form view and the "Person
Not Found" message popped up.

Correct useage of a breakpoint, F8 steps thru code line by line save keep
mouse clicking, if you then hover the mouse over each variable / control as
the code approaches *AND* passes you will see as variables get set and
change, if the mouse mouse hover bit doesn't work open then vba immediate
window and type in "?" without the quotes and then the variable / sql
statement etc (eg ? rs.FindFirst criteria after code has passed by 1 line).

My guess is, however, that your pop-up form is an unbound form with only the
listbox having a row/recordsource, in which case the me.RecordestClone has no
recordset TO clone (hover mouse over Set rs = .. to test) as the 2 codes are
then running simultaneously so the me. part is still referring to the pop-up.
Try [forms].[MainformName].[fsubPeople].RecordsetClone instead of me. - check
form and subform names.

You have found a good reason for not putting in error handling *until* you
know all the code is working 1st :p

Keep going you getting closer i think.

TonyT..
 

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