Pass Query Parameter value to form

I

Imran J Khan

Hi,
This may be a pretty basic questions, already answered here, but was not
able to find it so...
What I am trying to do is create a form that will take a walk-in client's
first name and phone number, and find if the client is already registered or
is a new client and needs to get registered.
What I have done is create a simple query with criterea for Firstname field
as [Name] and for the Telephone Number field as [Phone]. Then is used this
query as the record source for a form. When I run the form a pop up box askes
for Name and a second box askes for Phone, and if the client is in the
database, it comes up with record. If the client is not in the database, the
form opens as empty. My problem is that if the client is not in the database,
the form should open with the Name and Phone values entered in their
respective textboxes already so the user does not have type-in (or ask!) the
client's name and phone twice.

Any help will be greatly appreciated.
 
P

Piet Linden

Hi,
This may be a pretty basic questions, already answered here, but was not
able to find it so...
What I am trying to do is create a form that will take a walk-in client's
first name and phone number, and find if the client is already registeredor
is a new client and needs to get registered.
What I have done is create a simple query with criterea for Firstname field
as [Name] and for the Telephone Number field as [Phone]. Then is used this
query as the record source for a form. When I run the form a pop up box askes
for Name and a second box askes for Phone, and if the client is in the
database, it comes up with record. If the client is not in the database, the
form opens as empty. My problem is that if the client is not in the database,
the form should open with the Name and Phone values entered in their
respective textboxes already so the user does not have type-in (or ask!) the
client's name and phone twice.

Any help will be greatly appreciated.

One way would be to use DCount and your filter, and if your DCount
returns 1, then just open the form with the filter applied. If the
result of the DCount is 0, then open the form in Add mode. Then just
set the value of the Name/Phone No from the other form.

In the "People" form in Add Mode...
If Me.NewRecord then
Me.Controls("txtPersonName")=Forms!
OtherFormName.Controls("txtPersonName")
Me.Controls("txtPhoneNumber")=Forms!
OtherFormName.Controls("txtPhoneNumber")
End if
 

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