From: Pietro on
Hi ,

I'm changing my form recordsource through a button,sometimes the siurce
i'm changing to does not contain all the fields that already exist on my form.
I want to that the box that does not have a control source displays "N/A"
instead of "#Name?"
How can i do this ?
From: Brendan Reynolds on
"Pietro" <Pietro(a)discussions.microsoft.com> wrote in message
news:3BB88C79-74F3-4D0D-AB2B-784B2723197E(a)microsoft.com...
> Hi ,
>
> I'm changing my form recordsource through a button,sometimes the siurce
> i'm changing to does not contain all the fields that already exist on my
> form.
> I want to that the box that does not have a control source displays
> "N/A"
> instead of "#Name?"
> How can i do this ?


Use an expression in your SQL statement or saved query that returns the
literal value "N/A" and an alias that matches the field name. For example
....

If SomeCondition Then
Me.RecordSource = "SELECT SomeField, AnotherField FROM SomeTable"
Else
Me.RecordSource = "SELECT SomeField, 'N/A' AS AnotherField FROM
SomeTable"
End If

--
Brendan Reynolds

 | 
Pages: 1
Prev: jfdhfd
Next: linking files on a CD