Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering form by Unbound text box

Status
Not open for further replies.

Aqif

Programmer
Apr 27, 2002
240
AU
Hi :)

In my tabular form I have fields like DateSent, Amount etc. I also have few unbound text box which displays values after using Dlookup function. I am using the filter on DateSent as

Me.Filter="DateSent Is Null"
Me.FilterOn=True

Is it possible that I can filter the form according to Unbound text box like

Me.Filter="[MyUnboundTextBox]=0"

or anyother alternate approach?

Cheers!
ÙÇãá
 
In the footer (or header if you prefer) of your form put an unbound control where the user enters the date (or whatever field you want to use for record selection). Let's call it txtFindDateSent.

In the OnUpdate property of txtFindDateSent put something like the following code:

If IsNull(me.txtFindDateSent) then
me.filteron = true
me.filter = ""
me.requery
else
me.filteron = true
me.filter = "[DateSent] = #" & me.txtFindDateSent & "#"
me.requery
end if


I do this all the time and it provide a good user interface as well as working well.
 
Dear BSman:

I have already put filter on DateSent and its working fine. In my tabular form I also have an unbound textbox with dlookup fromula. I want to filter my form according to that like

Me.Form.Filter="[UnboundTextBox]=0"

Because that unbound textbox is not part of my query so I see its a bit difficult that is why I am asking for advice.
Cheers!
ÙÇãá
 
First, what is being looked up? I assume it's based on some other item the user selected (like the date sent). If so, then first you must force the UnboundTextBox to be requeried when the user has entered a value.

If the unbound text box is part of the displayed record, then I would assume it's based on a value that is part of the table/query's record. Let's say it looks up a value based on ID column that is part of the query. Your filter would then be based on on the lookup value displayed in the unbound text box, but on the value it is based on, which should either be in a different control (that could be non visible) or could be the value if you used a combo box instead of the unbound text box and set the ID column as the value of the box, but returned the ID and the description from the query source for the combo box and set the display width to 0" for the first column.

Your filter would then be
me.form.filter = "[ID] = " & me.txtID
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top