select in the midle of a criteria with iif...

  • Thread starter Thread starter =?iso-8859-1?Q?Luis_Assun=E7=E3o?=
  • Start date Start date
?

=?iso-8859-1?Q?Luis_Assun=E7=E3o?=

hello guys

i am trying to do a query that has a criteria like this:

=iif(isnull(formfield,"Select * from
tablefield",formfield))

but it isnot working and keeps giving me syntax errors.
can I do a select like I am doing in the midle of the iif?
if so, am I doing it right?

PLEASE HELP ME...

thanks
Luis
 
Hi,



= Nz( formfield, DLookup("whatField", "whatTable") )



You can also supply a third argument to DLookup, to precise a particular
record in the table.


Hoping it may help,
Vanderghast, Access MVP
 
HELLO

I am sorry but i dont understand. could you explain this
funtion yo me?

and maybe i should explain myself better. i want to do a
criteria that when the form fiel is empty it does
a "Select * from table dield", else it does a select to
the table field according to the value of the form field.

sorry if it his strange... :)

Luis
 
Hi,


You can put 10 or 200 values in ONE control. You can't put the result of

SELECT * whatever


since * refer to 10 or 200 fields, not to a particular field.
Furthermore, you may also have many ROWS, if you have more than one record,
which one will be use. Remember, you can only put ONE value in a control.
So, assuming you want ANY record, but field FName, then


= Nz( formfield, DLookup("FName", "TableNameHere") )



Nz and DLookup are explained in the help file.




Hoping it may help,
Vanderghast, Access MVP



HELLO

I am sorry but i dont understand. could you explain this
funtion yo me?

and maybe i should explain myself better. i want to do a
criteria that when the form fiel is empty it does
a "Select * from table dield", else it does a select to
the table field according to the value of the form field.

sorry if it his strange... :)

Luis
 
Back
Top