"N/A" instead of "#Name?"

P

Pietro

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 ?
 
B

Brendan Reynolds

Pietro said:
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
 
Top