Query two fields with only one input

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with two fields, one for the homephonenumbers, and one for the
workphonenumbers.
Let's say I want to query for the home phone number and also provide for
null values. Then the criteria query for the user to input would be:
Like [Enter Phone Number] & "*"
under the homephonenumbers field. How do I pass the value input in the
“Enter Phone Numberâ€, so I can also search and return values for the
workphonenumbers field simultaneously?
 
If I understand correctly, you can use the same exact parameter in two
different lines and under two different columns in your criteria.
 
Wouldn't that make the user to be requested twice about the number?, I just
want to capture the value entered by the user for one field, and query such
value in two fields. I know how to hard code it, but don't know it when the
value is input on the fly.
For example:
Let's assume that in the following two fields I have:

HomePhoneNumbers WorkPhoneNumbers
234-765-4443 675-543-6543
455-654-0923 234-785-4325

If I apply the following criteria in the HomePhoneNumbers field:
Like [Enter Phone Number] & “*â€
The user will be prompted to enter a phone number, let’s say he enters 234
The output will produce only one record, which is the first one
(234-765-443), right?
What I am looking for is how in addition to that record, without the asking
again, I could also query under the WorkPhoneNumbers field and capture the
second record (234-785-4325)

Thanks in advance

Duane Hookom said:
If I understand correctly, you can use the same exact parameter in two
different lines and under two different columns in your criteria.

--
Duane Hookom
Microsoft Access MVP


Jose DeSousa said:
I have a table with two fields, one for the homephonenumbers, and one for the
workphonenumbers.
Let's say I want to query for the home phone number and also provide for
null values. Then the criteria query for the user to input would be:
Like [Enter Phone Number] & "*"
under the homephonenumbers field. How do I pass the value input in the
“Enter Phone Numberâ€, so I can also search and return values for the
workphonenumbers field simultaneously?
 
How about putting a field in your query where both are joined and the query
is done under it:

SearchNumber = "HomePhoneNumber" & "WorkNumber"
Criteria put under SearchNumber

Jose DeSousa said:
Wouldn't that make the user to be requested twice about the number?, I
just
want to capture the value entered by the user for one field, and query
such
value in two fields. I know how to hard code it, but don't know it when
the
value is input on the fly.
For example:
Let's assume that in the following two fields I have:

HomePhoneNumbers WorkPhoneNumbers
234-765-4443 675-543-6543
455-654-0923 234-785-4325

If I apply the following criteria in the HomePhoneNumbers field:
Like [Enter Phone Number] & "*"
The user will be prompted to enter a phone number, let's say he enters 234
The output will produce only one record, which is the first one
(234-765-443), right?
What I am looking for is how in addition to that record, without the
asking
again, I could also query under the WorkPhoneNumbers field and capture the
second record (234-785-4325)

Thanks in advance

Duane Hookom said:
If I understand correctly, you can use the same exact parameter in two
different lines and under two different columns in your criteria.

--
Duane Hookom
Microsoft Access MVP


Jose DeSousa said:
I have a table with two fields, one for the homephonenumbers, and one
for the
workphonenumbers.
Let's say I want to query for the home phone number and also provide
for
null values. Then the criteria query for the user to input would be:
Like [Enter Phone Number] & "*"
under the homephonenumbers field. How do I pass the value input in the
"Enter Phone Number", so I can also search and return values for the
workphonenumbers field simultaneously?
 
Why don't you just try it rather than questioning? Trying it would take less
than half the time of replying back and asking if it would work.
--
Duane Hookom
Microsoft Access MVP


Jose DeSousa said:
Wouldn't that make the user to be requested twice about the number?, I just
want to capture the value entered by the user for one field, and query such
value in two fields. I know how to hard code it, but don't know it when the
value is input on the fly.
For example:
Let's assume that in the following two fields I have:

HomePhoneNumbers WorkPhoneNumbers
234-765-4443 675-543-6543
455-654-0923 234-785-4325

If I apply the following criteria in the HomePhoneNumbers field:
Like [Enter Phone Number] & “*â€
The user will be prompted to enter a phone number, let’s say he enters 234
The output will produce only one record, which is the first one
(234-765-443), right?
What I am looking for is how in addition to that record, without the asking
again, I could also query under the WorkPhoneNumbers field and capture the
second record (234-785-4325)

Thanks in advance

Duane Hookom said:
If I understand correctly, you can use the same exact parameter in two
different lines and under two different columns in your criteria.

--
Duane Hookom
Microsoft Access MVP


Jose DeSousa said:
I have a table with two fields, one for the homephonenumbers, and one for the
workphonenumbers.
Let's say I want to query for the home phone number and also provide for
null values. Then the criteria query for the user to input would be:
Like [Enter Phone Number] & "*"
under the homephonenumbers field. How do I pass the value input in the
“Enter Phone Numberâ€, so I can also search and return values for the
workphonenumbers field simultaneously?
 
Back
Top