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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use right and left functions in queries??

Status
Not open for further replies.

marlun

Programmer
Feb 7, 2003
70
0
0
SE
Hi! I have a query thats selects objects, with long serielnumbers. I want the query to select the objects with similar first 8 characters. How do write that? Now I have the following command in the criteriabox: Left([Forms]![frmSök]![Text14],8)

Does anyone know how to solve this

Thanks
 
If you want to select a serial number from the list and list all those that match your selection then:
The query column would have your Left() statement set against the serial Number similar to
Name - ToFind:Left([SerialNumber], 8)
Criteria - Like [Forms]![frmSök]![Text14] & "*"
This takes the contents of Text14 and then compares the serial number entries with the entry.

Frank J Hill
FHS Services Ltd.
frank@fhsservices.co.uk
 
One remark:
ToFind: Trim(Left([SerialNumber] & " ", 8))

Add 8 spaces to the right of SerialNumber, just in case Serial Number has less than 8 characters. And that will save you from error messages.

HTH



[pipe]
Daniel Vlas
Systems Consultant

 
Hi again. I'm not sure I understand.
I have a form where I select a serialnumber in a combobox. It vcan look like 4-475-12312456, where 4-475-12 is similar in many serialnumbers. So when I select a serialnumber in the combobox and then presses a button I want it to show all the "products" with 4-475-12 in its serailnumber in a listbox.

Maybe that's how you thought I meant, but I'm not sure how to write it.

 
Is anyone there. Would appreciate any help with this.
 
I have tried following:
Field: ToFind: Trim(Left([tblLager]![ProdSN] & " ",8))
Criteria: Like [Forms]![frmSök]![Text14] & "*"

This doesn't give me any result. The format on serialnumber is text. Does that make any differance.
 
Thanks danvlas, that worked like a charm.

/marlun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top