Picking up criteria from form box

L

Les

I have a query which works fine if I put the Like"*Oil" criteria in the
design grid. But what I want to do is take the Like value fron a form box.

I have tried Like [form and box name] and Like"*[form and box name] but
without success. The Box is an unbound free text entry.

What is the correct syntax please.

Thanks

Les
 
F

fredg

I have a query which works fine if I put the Like"*Oil" criteria in the
design grid. But what I want to do is take the Like value fron a form box.

I have tried Like [form and box name] and Like"*[form and box name] but
without success. The Box is an unbound free text entry.

What is the correct syntax please.

Thanks

Les

Like "*" & forms!FormName!ControlName
to find records in which the field ends with the entry in the control.

Like forms!FormName!ControlName & "*"
to find records in which the field begins with the entry in the
control.

Like "*" & forms!FormName!ControlName & "*"
to find records in which the field contains the entry in the control
anywhere in the field.

Change FormName to the actual name of the form.
Change ControlName to the actual name of the control.
 
G

Graham Mandeno

Hi Les

Use vertical bars around the textbox reference:

Like "*|[Forms]![YourForm]![YourTextBox]|*"
 
L

Les

Thats great one problem that as occured that I did not concider is the fact
that the user can now change the field contents which they should not have
access to. Other than displaying the list in a locked form is there a way
of preventing this?

Thanks

Les


fredg said:
I have a query which works fine if I put the Like"*Oil" criteria in the
design grid. But what I want to do is take the Like value fron a form box.

I have tried Like [form and box name] and Like"*[form and box name] but
without success. The Box is an unbound free text entry.

What is the correct syntax please.

Thanks

Les

Like "*" & forms!FormName!ControlName
to find records in which the field ends with the entry in the control.

Like forms!FormName!ControlName & "*"
to find records in which the field begins with the entry in the
control.

Like "*" & forms!FormName!ControlName & "*"
to find records in which the field contains the entry in the control
anywhere in the field.

Change FormName to the actual name of the form.
Change ControlName to the actual name of the control.
 
F

fredg

Thats great one problem that as occured that I did not concider is the fact
that the user can now change the field contents which they should not have
access to. Other than displaying the list in a locked form is there a way
of preventing this?

Thanks

Les

fredg said:
I have a query which works fine if I put the Like"*Oil" criteria in the
design grid. But what I want to do is take the Like value fron a form box.

I have tried Like [form and box name] and Like"*[form and box name] but
without success. The Box is an unbound free text entry.

What is the correct syntax please.

Thanks

Les

Like "*" & forms!FormName!ControlName
to find records in which the field ends with the entry in the control.

Like forms!FormName!ControlName & "*"
to find records in which the field begins with the entry in the
control.

Like "*" & forms!FormName!ControlName & "*"
to find records in which the field contains the entry in the control
anywhere in the field.

Change FormName to the actual name of the form.
Change ControlName to the actual name of the control.
Set the form's control to
Enable = No.
Or
Locked = Yes
Or
Enabled= No and Locked = Yes
Or...
Set the Form's Allow Edits property to No
 
L

Les

Thanks for that

Les

fredg said:
Thats great one problem that as occured that I did not concider is the fact
that the user can now change the field contents which they should not have
access to. Other than displaying the list in a locked form is there a way
of preventing this?

Thanks

Les

fredg said:
On Thu, 17 Jun 2004 22:37:28 +0100, Les wrote:

I have a query which works fine if I put the Like"*Oil" criteria in the
design grid. But what I want to do is take the Like value fron a form box.

I have tried Like [form and box name] and Like"*[form and box name] but
without success. The Box is an unbound free text entry.

What is the correct syntax please.

Thanks

Les

Like "*" & forms!FormName!ControlName
to find records in which the field ends with the entry in the control.

Like forms!FormName!ControlName & "*"
to find records in which the field begins with the entry in the
control.

Like "*" & forms!FormName!ControlName & "*"
to find records in which the field contains the entry in the control
anywhere in the field.

Change FormName to the actual name of the form.
Change ControlName to the actual name of the control.
Set the form's control to
Enable = No.
Or
Locked = Yes
Or
Enabled= No and Locked = Yes
Or...
Set the Form's Allow Edits property to No
 

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