Go to record that matches the control

  • Thread starter HLCruz via AccessMonster.com
  • Start date
H

HLCruz via AccessMonster.com

Please help - I am new to VBA ... I have a form in which I'm using a
"searching" list box that allows users to type in a client name (last name,
first name) in a text box. The code "searches" through the records in a list
box and hightlights the correct client name as you type. Now I'd like for
the form to populate with the correct record information once I select the
client (either by click or enter).

I have tried using the following code for the On Click property in my list
box, for which I get a Run-Time error "type mismatch".

Private Sub lstNameSearch_Click()
' Find the record that matches the control.

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Key] = " & Str(Nz(Me![cboFindRecord], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

This code works fine for the combo box I have that allows people to search by
scrolling through the names alphabetically. What am I not understanding here?


Thanks to anyone who could help!
 
R

Rob Parker

I suspect that your Key field is a numeric datatype. However, you are
converting the value of your combo-box to a string for the .FindFirst
operation. Try simply omitting the conversion:

rs.FindFirst "[Key] = " & Nz(Me![cboFindRecord], 0)

On the other hand, if your Key field is actually a text field, you will need
the conversion if your combobox is bound to a numeric datatype. But in that
case, you'll also need string delimiters in the .FindFirst statement:

rs.FindFirst "[Key] = '" & Str(Nz(Me![cboFindRecord], 0)) & "'"

I'm also puzzled as to why you are using the value of a combo-box in the
click event of a list-box.

HTH,

Rob
 
H

HLCruz via AccessMonster.com

Thanks Rob! Removing Str from the equation worked. (Sorry I confused you
with the combo box value, that was a typo on my part when I posted my message)


However, now I have a second issue: We are searching for clients by last
name and then first name. I'm concatenating the last name with a ", " and
the first name. Entering the text in the text box searches for the correct
name, which appears as Smith, Joe ... but when I click or enter on the
highlighted person I get the following error:

Syntax error (comma) in expression.

When I click Debug, VBA highlights this line of code:

rs.FindFirst "[Key] = " & Nz(Me![lstNameSearch], 0)

Do I need to revise my code so that it can search for the record based on the
formatted name? I thought that was the benefit of having a primary key field
... that the record was found based on that field ...

Thanks again for any help. It's very appreciated.

Rob said:
I suspect that your Key field is a numeric datatype. However, you are
converting the value of your combo-box to a string for the .FindFirst
operation. Try simply omitting the conversion:

rs.FindFirst "[Key] = " & Nz(Me![cboFindRecord], 0)

On the other hand, if your Key field is actually a text field, you will need
the conversion if your combobox is bound to a numeric datatype. But in that
case, you'll also need string delimiters in the .FindFirst statement:

rs.FindFirst "[Key] = '" & Str(Nz(Me![cboFindRecord], 0)) & "'"

I'm also puzzled as to why you are using the value of a combo-box in the
click event of a list-box.

HTH,

Rob
Please help - I am new to VBA ... I have a form in which I'm using a
"searching" list box that allows users to type in a client name (last
[quoted text clipped - 25 lines]
Thanks to anyone who could help!
 
R

Rob Parker

I'm getting rather more puzzled as to exactly how your form is set up.

You've already described a combo-box, and a list-box; now your problem is
with a textbox which is giving an error in a line which is using the value
of the list-box (I'm assuming that lstNameSearch is the name of your
list-box control - and that you haven't made another typo in your posting).
In particular, I don't understand what you mean by "Entering the text in the
text box searches for the correct name, which appears as Smith, Joe ... but
when I click or enter on the highlighted person I get the following error:"

Perhaps you have several alternate methods of allowing people to enter the
name to be searched for - a combo-box (hopefully with Limit to List set to
Yes, to allow autofind as characters are entered), a list-box displaying all
names for select-and-click, and a text box for free-form text entry of a
name string.

Assuming that this is the case, then your combo-box and list-box searches
will work because both these controls will both be bound to the Key field -
a numeric field (most likely an autonumber) which is the primary key for
your clients table; the controls will probably not be displaying the key
field, but will instead display the name fields (or the name string you say
you have formed by concatenating last name and first name).

However, if you want to allow free-form entry of a name string in a textbox
and then search by that, you are no longer searching on the primary key;
instead, you need to search on the last name and first name fields, or the
single concatenated fullname field. Your .FindFirst expression should be
something like:
rs.FindFirst "[FullName] = '" & Me![txtNameSearch] & "'"

where [FullName} is the name of your concatenated name string field, and
txtNameSearch is the name of the textbox control into which the search name
string is being entered. Note that this will break if any of your names
contain an apostrophe (the same character as the single-quote character I'm
using as the string delimiter); you can prevent this by using a pair of
double-quote charaters as the string delimiter, thus:
rs.FindFirst "[FullName] = """ & Me![txtNameSearch] & """"

If this isn't sufficient to solve your problem, please post more details of
your form and its controls: the form's recordsource (either the SQL of the
query or details of the table), the recordsources of the combo-box and
list-box and their bound columns and displayed columns, and the VBA code you
are using (cut and paste directly from the IDE to avoid any extraneous
typos).

I may have the wrong end of the stick in what I've described above, but as I
said, I'm puzzled by what you've written to date; in particular, I don't
understand what you mean by "Entering the text in the text box searches for
the correct name, which appears as Smith, Joe ... but when I click or enter
on the highlighted person I get the following error:" Does this mean that
you've got a free-entry textbox search which works? Is your error coming
from the list-box or the textbox event?


HTH,

Rob


HLCruz via AccessMonster.com said:
Thanks Rob! Removing Str from the equation worked. (Sorry I confused you
with the combo box value, that was a typo on my part when I posted my
message)


However, now I have a second issue: We are searching for clients by last
name and then first name. I'm concatenating the last name with a ", " and
the first name. Entering the text in the text box searches for the
correct
name, which appears as Smith, Joe ... but when I click or enter on the
highlighted person I get the following error:

Syntax error (comma) in expression.

When I click Debug, VBA highlights this line of code:

rs.FindFirst "[Key] = " & Nz(Me![lstNameSearch], 0)

Do I need to revise my code so that it can search for the record based on
the
formatted name? I thought that was the benefit of having a primary key
field
.. that the record was found based on that field ...

Thanks again for any help. It's very appreciated.

Rob said:
I suspect that your Key field is a numeric datatype. However, you are
converting the value of your combo-box to a string for the .FindFirst
operation. Try simply omitting the conversion:

rs.FindFirst "[Key] = " & Nz(Me![cboFindRecord], 0)

On the other hand, if your Key field is actually a text field, you will
need
the conversion if your combobox is bound to a numeric datatype. But in
that
case, you'll also need string delimiters in the .FindFirst statement:

rs.FindFirst "[Key] = '" & Str(Nz(Me![cboFindRecord], 0)) & "'"

I'm also puzzled as to why you are using the value of a combo-box in the
click event of a list-box.

HTH,

Rob
Please help - I am new to VBA ... I have a form in which I'm using a
"searching" list box that allows users to type in a client name (last
[quoted text clipped - 25 lines]
Thanks to anyone who could help!
 
H

HLCruz via AccessMonster.com

Thank You Rob, for all your help! I have been working with FileMaker for
several years and sometimes find the processes in Access/VBA confusing; sorry
if my explanations are difficult to understand - hopefully I can explain it
better by answering each of your questions.

1. Yes, my form is set up with multiple ways of searching for a record. I
am doing this because I'm not crazy about the ctl-F "Find" feature in Access.
In FileMaker this is such a simple feature, so it frustrates me that I can't
get it to work in Access.

2. I do have a "free-entry textbox search which works", so I believe it's
the list-box "OnEnter" event that is my trouble. This is how it's been
working: I type text into the text box; as I type, the matching record is
highlighted in the list-box. Typing "j" highlights the first record that has
a last name begining with "j", and so on. So, if I typed "johnson" I would
get the first Johnson record. By the way, all of this occurs on the form's
header ... My trouble is that I can't seem to tell the procedure to then
populate the body of the form with the record data after I click the name.
When I click the name the error code I'm getting is:

Run-time error '3077':

Syntax error (comma) in expression

The only logic I can deduce from this error is that the comma in my
"FullName" field, which is formatted as Smith, John is the problem. But I
could be very wrong! Can I use

3. The set up is a text box which has the following even procedures:

Private Sub txtNameSearch_Change()
Dim varRetval As Variant

varRetval = acbDoSearchDynaset(Me.txtNameSearch, _
Me.lstNameSearch, "FullName")

End Sub

Private Sub txtNameSearch_Exit(Cancel As Integer)
acbUpdateSearch Me.txtNameSearch, Me.lstNameSearch

End Sub

Next to the text box is a list-box, with ColumnCount 2, ColumnWidth 0,
BoundColumn, 2 and the RowSource is qryFullNameSearch:

SELECT tblDonors.Key, [LastName] & ", " & [FirstName] AS FullName
FROM tblDonors
ORDER BY tblDonors.LastName, tblDonors.FirstName;

This List-Box also has the following event procedures:

Private Sub lstNameSearch_AfterUpdate()
acbUpdateSearch Me.txtNameSearch, Me.lstNameSearch

End Sub

Private Sub lstNameSearch_Click()
' Find the record that matches the control.

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[FullName] = " & Nz(Me![lstNameSearch], 0)
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

I hope that I've explained my process and my problem much better this time
around. Thanks in advance to you, or anyone else, who is gracious enough to
help me out!




Rob said:
I'm getting rather more puzzled as to exactly how your form is set up.

You've already described a combo-box, and a list-box; now your problem is
with a textbox which is giving an error in a line which is using the value
of the list-box (I'm assuming that lstNameSearch is the name of your
list-box control - and that you haven't made another typo in your posting).
In particular, I don't understand what you mean by "Entering the text in the
text box searches for the correct name, which appears as Smith, Joe ... but
when I click or enter on the highlighted person I get the following error:"

Perhaps you have several alternate methods of allowing people to enter the
name to be searched for - a combo-box (hopefully with Limit to List set to
Yes, to allow autofind as characters are entered), a list-box displaying all
names for select-and-click, and a text box for free-form text entry of a
name string.

Assuming that this is the case, then your combo-box and list-box searches
will work because both these controls will both be bound to the Key field -
a numeric field (most likely an autonumber) which is the primary key for
your clients table; the controls will probably not be displaying the key
field, but will instead display the name fields (or the name string you say
you have formed by concatenating last name and first name).

However, if you want to allow free-form entry of a name string in a textbox
and then search by that, you are no longer searching on the primary key;
instead, you need to search on the last name and first name fields, or the
single concatenated fullname field. Your .FindFirst expression should be
something like:
rs.FindFirst "[FullName] = '" & Me![txtNameSearch] & "'"

where [FullName} is the name of your concatenated name string field, and
txtNameSearch is the name of the textbox control into which the search name
string is being entered. Note that this will break if any of your names
contain an apostrophe (the same character as the single-quote character I'm
using as the string delimiter); you can prevent this by using a pair of
double-quote charaters as the string delimiter, thus:
rs.FindFirst "[FullName] = """ & Me![txtNameSearch] & """"

If this isn't sufficient to solve your problem, please post more details of
your form and its controls: the form's recordsource (either the SQL of the
query or details of the table), the recordsources of the combo-box and
list-box and their bound columns and displayed columns, and the VBA code you
are using (cut and paste directly from the IDE to avoid any extraneous
typos).

I may have the wrong end of the stick in what I've described above, but as I
said, I'm puzzled by what you've written to date; in particular, I don't
understand what you mean by "Entering the text in the text box searches for
the correct name, which appears as Smith, Joe ... but when I click or enter
on the highlighted person I get the following error:" Does this mean that
you've got a free-entry textbox search which works? Is your error coming
from the list-box or the textbox event?

HTH,

Rob
Thanks Rob! Removing Str from the equation worked. (Sorry I confused you
with the combo box value, that was a typo on my part when I posted my
[quoted text clipped - 47 lines]
 
R

Rob Parker

You say "... so I believe it's the list-box "OnEnter" event that is my
trouble."; but you've not shown any code for that event. And the problem
appears to be with the list-box's OnClick event code, which you have shown.
The problem is with the line:

rs.FindFirst "[FullName] = " & Nz(Me![lstNameSearch], 0)

This will not work with your list-box set-up as you have described (bound
column 2), because the [FullName] field is a text datatype; you therefore
need to delimit the search parameter with a suitable text delimiter - either
a single-quote character (which will give problems if any of your names
contain an apostrophe, as I explained in a previous post) or a pair of
double-quote characters. You also should not set the Nz null-value to a
number if the datatype of the field is a string - you should set it to (most
commonly) a zero-length string; but there is no reason to include the Nz
function at all, since you cannot click on a null entry in the list-box.
So, the code should be:

rs.FindFirst "[FullName] = """ & Me![lstNameSearch] & """"

An alternative method of getting this to work would be to set the list-box
bound column to 1 (ie. to the Key field), and then search on that, as a
numeric datatype:

rs.FindFirst "[Key] = " & Nz(Me![lstNameSearch], 0)

(Again, the Nz function is not needed; but there is no problem with
including it.)

I notice that you also have code in the list-box's AfterUpdate event, which
calls a custom subroutine or function acbUpdateSearch; this is also called
from txtNameSearch_Exit. I've got no idea what this does (or even if it's
needed); but it could be the source of your error, since the list-box
AfterUpdate event will occur before the Click event. You do say that the
error is coming from the Click event, however, so this shouldn't be the
problem.

HTH,

Rob


HLCruz via AccessMonster.com said:
Thank You Rob, for all your help! I have been working with FileMaker for
several years and sometimes find the processes in Access/VBA confusing;
sorry
if my explanations are difficult to understand - hopefully I can explain
it
better by answering each of your questions.

1. Yes, my form is set up with multiple ways of searching for a record.
I
am doing this because I'm not crazy about the ctl-F "Find" feature in
Access.
In FileMaker this is such a simple feature, so it frustrates me that I
can't
get it to work in Access.

2. I do have a "free-entry textbox search which works", so I believe it's
the list-box "OnEnter" event that is my trouble. This is how it's been
working: I type text into the text box; as I type, the matching record is
highlighted in the list-box. Typing "j" highlights the first record that
has
a last name begining with "j", and so on. So, if I typed "johnson" I
would
get the first Johnson record. By the way, all of this occurs on the
form's
header ... My trouble is that I can't seem to tell the procedure to then
populate the body of the form with the record data after I click the name.
When I click the name the error code I'm getting is:

Run-time error '3077':

Syntax error (comma) in expression

The only logic I can deduce from this error is that the comma in my
"FullName" field, which is formatted as Smith, John is the problem. But I
could be very wrong! Can I use

3. The set up is a text box which has the following even procedures:

Private Sub txtNameSearch_Change()
Dim varRetval As Variant

varRetval = acbDoSearchDynaset(Me.txtNameSearch, _
Me.lstNameSearch, "FullName")

End Sub

Private Sub txtNameSearch_Exit(Cancel As Integer)
acbUpdateSearch Me.txtNameSearch, Me.lstNameSearch

End Sub

Next to the text box is a list-box, with ColumnCount 2, ColumnWidth 0,
BoundColumn, 2 and the RowSource is qryFullNameSearch:

SELECT tblDonors.Key, [LastName] & ", " & [FirstName] AS FullName
FROM tblDonors
ORDER BY tblDonors.LastName, tblDonors.FirstName;

This List-Box also has the following event procedures:

Private Sub lstNameSearch_AfterUpdate()
acbUpdateSearch Me.txtNameSearch, Me.lstNameSearch

End Sub

Private Sub lstNameSearch_Click()
' Find the record that matches the control.

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[FullName] = " & Nz(Me![lstNameSearch], 0)
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

I hope that I've explained my process and my problem much better this time
around. Thanks in advance to you, or anyone else, who is gracious enough
to
help me out!




Rob said:
I'm getting rather more puzzled as to exactly how your form is set up.

You've already described a combo-box, and a list-box; now your problem is
with a textbox which is giving an error in a line which is using the value
of the list-box (I'm assuming that lstNameSearch is the name of your
list-box control - and that you haven't made another typo in your
posting).
In particular, I don't understand what you mean by "Entering the text in
the
text box searches for the correct name, which appears as Smith, Joe ...
but
when I click or enter on the highlighted person I get the following
error:"

Perhaps you have several alternate methods of allowing people to enter the
name to be searched for - a combo-box (hopefully with Limit to List set to
Yes, to allow autofind as characters are entered), a list-box displaying
all
names for select-and-click, and a text box for free-form text entry of a
name string.

Assuming that this is the case, then your combo-box and list-box searches
will work because both these controls will both be bound to the Key
field -
a numeric field (most likely an autonumber) which is the primary key for
your clients table; the controls will probably not be displaying the key
field, but will instead display the name fields (or the name string you
say
you have formed by concatenating last name and first name).

However, if you want to allow free-form entry of a name string in a
textbox
and then search by that, you are no longer searching on the primary key;
instead, you need to search on the last name and first name fields, or the
single concatenated fullname field. Your .FindFirst expression should be
something like:
rs.FindFirst "[FullName] = '" & Me![txtNameSearch] & "'"

where [FullName} is the name of your concatenated name string field, and
txtNameSearch is the name of the textbox control into which the search
name
string is being entered. Note that this will break if any of your names
contain an apostrophe (the same character as the single-quote character
I'm
using as the string delimiter); you can prevent this by using a pair of
double-quote charaters as the string delimiter, thus:
rs.FindFirst "[FullName] = """ & Me![txtNameSearch] & """"

If this isn't sufficient to solve your problem, please post more details
of
your form and its controls: the form's recordsource (either the SQL of the
query or details of the table), the recordsources of the combo-box and
list-box and their bound columns and displayed columns, and the VBA code
you
are using (cut and paste directly from the IDE to avoid any extraneous
typos).

I may have the wrong end of the stick in what I've described above, but as
I
said, I'm puzzled by what you've written to date; in particular, I don't
understand what you mean by "Entering the text in the text box searches
for
the correct name, which appears as Smith, Joe ... but when I click or
enter
on the highlighted person I get the following error:" Does this mean that
you've got a free-entry textbox search which works? Is your error coming
from the list-box or the textbox event?

HTH,

Rob
Thanks Rob! Removing Str from the equation worked. (Sorry I confused
you
with the combo box value, that was a typo on my part when I posted my
[quoted text clipped - 47 lines]
Thanks to anyone who could help!
 
H

HLCruz via AccessMonster.com

Thanks Rob, but neither of these options really work. The first one:
So, the code should be:

rs.FindFirst "[FullName] = """ & Me![lstNameSearch] & """"

returns - Run-Time error '3070':
The Microsoft Jet database engine does not recognize 'FullName' as a valid
field name or expression.

The second solution,
An alternative method of getting this to work would be to set the list-box
bound column to 1 (ie. to the Key field), and then search on that, as a
numeric datatype:

rs.FindFirst "[Key] = " & Nz(Me![lstNameSearch], 0)
Does populate the form, however changing that bound field means my searching
text box doesn't work.

I believe I posted this already, but here is the SQL for the query I'm using
which includes that 'FullName' field this error is referring to
SELECT tblDonors.Key, [LastName] & ", " & [FirstName] AS FullName
FROM tblDonors
ORDER BY tblDonors.LastName, tblDonors.FirstName;


I still think the problem is that 'FullName' field, but I have no idea why ...


This entire thing works in my table of organizations, but the field I am
searching by is just one field with an organization name ...




Rob said:
You say "... so I believe it's the list-box "OnEnter" event that is my
trouble."; but you've not shown any code for that event. And the problem
appears to be with the list-box's OnClick event code, which you have shown.
The problem is with the line:

rs.FindFirst "[FullName] = " & Nz(Me![lstNameSearch], 0)

This will not work with your list-box set-up as you have described (bound
column 2), because the [FullName] field is a text datatype; you therefore
need to delimit the search parameter with a suitable text delimiter - either
a single-quote character (which will give problems if any of your names
contain an apostrophe, as I explained in a previous post) or a pair of
double-quote characters. You also should not set the Nz null-value to a
number if the datatype of the field is a string - you should set it to (most
commonly) a zero-length string; but there is no reason to include the Nz
function at all, since you cannot click on a null entry in the list-box.
So, the code should be:

rs.FindFirst "[FullName] = """ & Me![lstNameSearch] & """"

An alternative method of getting this to work would be to set the list-box
bound column to 1 (ie. to the Key field), and then search on that, as a
numeric datatype:

rs.FindFirst "[Key] = " & Nz(Me![lstNameSearch], 0)

(Again, the Nz function is not needed; but there is no problem with
including it.)

I notice that you also have code in the list-box's AfterUpdate event, which
calls a custom subroutine or function acbUpdateSearch; this is also called
from txtNameSearch_Exit. I've got no idea what this does (or even if it's
needed); but it could be the source of your error, since the list-box
AfterUpdate event will occur before the Click event. You do say that the
error is coming from the Click event, however, so this shouldn't be the
problem.

HTH,

Rob
Thank You Rob, for all your help! I have been working with FileMaker for
several years and sometimes find the processes in Access/VBA confusing;
[quoted text clipped - 155 lines]
 
R

Rob Parker

Different error, due to different problem. It's likely that the
recordsource for the form itself does not contain the FullName field which
you have in the recordscource for the list-box (perhaps it's based on
tblDonors itself). You must have the field on which you are trying to
search in the recordset you are searching on. Set up a query for the form
which includes the concatenated FullName field, exactly as you've got it it
the query for the list-box. You don't need to include the field in a bound
control on the form itself, but it must be available in the recordset.

HTH,

Rob


HLCruz via AccessMonster.com said:
Thanks Rob, but neither of these options really work. The first one:
So, the code should be:

rs.FindFirst "[FullName] = """ & Me![lstNameSearch] & """"

returns - Run-Time error '3070':
The Microsoft Jet database engine does not recognize 'FullName' as a valid
field name or expression.

The second solution,
An alternative method of getting this to work would be to set the list-box
bound column to 1 (ie. to the Key field), and then search on that, as a
numeric datatype:

rs.FindFirst "[Key] = " & Nz(Me![lstNameSearch], 0)
Does populate the form, however changing that bound field means my
searching
text box doesn't work.

I believe I posted this already, but here is the SQL for the query I'm
using
which includes that 'FullName' field this error is referring to
SELECT tblDonors.Key, [LastName] & ", " & [FirstName] AS FullName
FROM tblDonors
ORDER BY tblDonors.LastName, tblDonors.FirstName;


I still think the problem is that 'FullName' field, but I have no idea why
...


This entire thing works in my table of organizations, but the field I am
searching by is just one field with an organization name ...




Rob said:
You say "... so I believe it's the list-box "OnEnter" event that is my
trouble."; but you've not shown any code for that event. And the problem
appears to be with the list-box's OnClick event code, which you have
shown.
The problem is with the line:

rs.FindFirst "[FullName] = " & Nz(Me![lstNameSearch], 0)

This will not work with your list-box set-up as you have described (bound
column 2), because the [FullName] field is a text datatype; you therefore
need to delimit the search parameter with a suitable text delimiter -
either
a single-quote character (which will give problems if any of your names
contain an apostrophe, as I explained in a previous post) or a pair of
double-quote characters. You also should not set the Nz null-value to a
number if the datatype of the field is a string - you should set it to
(most
commonly) a zero-length string; but there is no reason to include the Nz
function at all, since you cannot click on a null entry in the list-box.
So, the code should be:

rs.FindFirst "[FullName] = """ & Me![lstNameSearch] & """"

An alternative method of getting this to work would be to set the list-box
bound column to 1 (ie. to the Key field), and then search on that, as a
numeric datatype:

rs.FindFirst "[Key] = " & Nz(Me![lstNameSearch], 0)

(Again, the Nz function is not needed; but there is no problem with
including it.)

I notice that you also have code in the list-box's AfterUpdate event,
which
calls a custom subroutine or function acbUpdateSearch; this is also called
from txtNameSearch_Exit. I've got no idea what this does (or even if it's
needed); but it could be the source of your error, since the list-box
AfterUpdate event will occur before the Click event. You do say that the
error is coming from the Click event, however, so this shouldn't be the
problem.

HTH,

Rob
Thank You Rob, for all your help! I have been working with FileMaker
for
several years and sometimes find the processes in Access/VBA confusing;
[quoted text clipped - 155 lines]
Thanks to anyone who could help!
 
H

HLCruz via AccessMonster.com

Rob - Thank You, Thank You, Thank You!

It works and what you explained below really makes sense now. I appreciate
your patience and willingness to teach me!

Rob said:
Different error, due to different problem. It's likely that the
recordsource for the form itself does not contain the FullName field which
you have in the recordscource for the list-box (perhaps it's based on
tblDonors itself). You must have the field on which you are trying to
search in the recordset you are searching on. Set up a query for the form
which includes the concatenated FullName field, exactly as you've got it it
the query for the list-box. You don't need to include the field in a bound
control on the form itself, but it must be available in the recordset.

HTH,

Rob
Thanks Rob, but neither of these options really work. The first one:
So, the code should be: [quoted text clipped - 80 lines]

Thanks to anyone who could help!
 
R

Rob Parker

You're welcome. Glad it's working, and, more importantly, that you
understand how it works - and why it didn't originally!

Rob

HLCruz via AccessMonster.com said:
Rob - Thank You, Thank You, Thank You!

It works and what you explained below really makes sense now. I
appreciate
your patience and willingness to teach me!

Rob said:
Different error, due to different problem. It's likely that the
recordsource for the form itself does not contain the FullName field which
you have in the recordscource for the list-box (perhaps it's based on
tblDonors itself). You must have the field on which you are trying to
search in the recordset you are searching on. Set up a query for the form
which includes the concatenated FullName field, exactly as you've got it
it
the query for the list-box. You don't need to include the field in a
bound
control on the form itself, but it must be available in the recordset.

HTH,

Rob
Thanks Rob, but neither of these options really work. The first one:
So, the code should be:
[quoted text clipped - 80 lines]
Thanks to anyone who could help!
 

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