Searching for a value Between Numbers

me3

Registered User.
Local time
Today, 16:49
Joined
Nov 23, 2014
Messages
13
Hi all - 1st post so a little introduction - I am 17, my father owns a towbar and trailer company and I am making a database so he can search for a trailer to suit the boat. I have fair knowledge of Access, making one for an estate agency company in my year 12 school project.

In the Table I have in the trailer database has, among many, 2 fields called 'Maximum Length' and 'Minimum Length'. Say, the data in these fields could be 5 and 4 respectively. I would like to create a search box where I can type in any length such as 4.4 and the database would return the trailer that can fit this length. (Sot the searched value is between the Min. and Max. length)
What would I need to type into the query box and the search form to type in the length? Is this even possible?
Thankyou for taking the time to read this :D
 
So you all want all of records where the "ActualLength" is <= "Maximum Length" and >= "Minimum Length", right? Does that give you any ideas?
 
So you all want all of records where the "ActualLength" is <= "Maximum Length" and >= "Minimum Length", right? Does that give you any ideas?

Thanks, that is what I am after, I suppose it would be

Like "*" & <=[Forms]![Boat_Trailer]![Max_Length] AND >=[Forms]![Boat_Trailer]![Min_Length] "*" &
 
Why "Like"? That is for string matches. Assuming you will launch this from the "Boat_Trailer" form then you can provide a WHERE CONDITION argument directly from the controls.
 
BTW, your logic is backwards. The "ActualLength" is a control on your form and the Max_Length and Min_Length are fields in your table.
 
Yes - I completely agree - I have just done what you suggested and it has worked perfectly! Thanks, I didn't put the { Like "*" & } in. If I put the "*" & this means that search box doesn't have to have data in to search another field. is that correct?
 
Excellent! I'm not sure what you mean by your last sentence. Sorry for the long delay but I was tearing apart a laptop and cleaning the fan. Hate those things.
 

Users who are viewing this thread

Back
Top Bottom