How to create code

  • Thread starter Thread starter Nora
  • Start date Start date
N

Nora

I want 3 fields for my query criteria in a Form.
Field1 "Code"
Field2 "Reg. No."
Field3 "Part"

E.g. :
Code = "GQ" or "MQ" or "SQ" (2 letters only)
Reg. No. = "7687" or "112" (4 or 3 digits)
Part = "A" or "AB" (1 or 2 letters)

Input data = "GQ" + "7687" Only = (Result shows 2 records)
OR
Input data = "GQ" + "7687" + "A" Only = (Result shows exact 1 record)

My plan is to make the "Part" textbox as an optional input.
So that any1 who know exact data may enter otherwise leave it empty.

Can any1 please help me with this? Thanks.
 
On Wed, 28 Oct 2009 05:31:01 -0700, Nora

Perhaps you could use the LIKE keyword and a wildcard. Your query1
would then be:
select *
from myTable
where Code='GQ' and RegNo=7687 and Part like '*'
whereas the same where-clause in the second query would be:
where Code='GQ' and RegNo=7687 and Part like 'A'

HTH,

-Tom.
Microsoft Access MVP
 
Back
Top