If Blank Then....

bradwould

Custom User Title & Such
Local time
Today, 03:55
Joined
Nov 30, 2005
Messages
39
I was wondering if there is a way to have a default value in a table field which is dependant on whether there was data enterd in said field or not. For example. I do not want any blank fields on my table instead I want "N/A" in the fields that were not used. I have tried setting the "default value" of the fields to N/A and it does work. The only problem is that all of the fields are filled with N/A automatically and in order to enter data one has to delete or "overwrite" N/A. Is there a way that N/A will be entered ONLY if the field is skipped over and left blank.

"Using way too many quotation marks"
Brad

Thanks
 
I would argue that you shouldn't store a load of "N/A" strings in your database when it doesn't tell you anything that a blank field wouldn't.
 
true enough

I have thought of that and it is a very valid argument. What worries me is specific to the database i am creating. I have a table with columns describing functions on a device. I am worried that an empty field may cause the person who is entering the data to think that the record is incomplete when infact that function just isnt used in a certain product.

ie: (busy fingers)+(empty fields)=problems
 
When making the query for the record source of you form you can use an iif function to have an N/A in every null field. Would this work

iif(isnull([FieldName])=-1,"N/A",[FieldName])

something like that should work for you.

[FieldName]=Name of Field
 
Well you can add some code to each textbox _LostFocus() event

Code:
Private Sub txtYourTextBox_LostFocus()

    If Len(txtYourTextBox) < 1 Then
        txtYourTextBox = "N\A"
    End If
End Sub

But I implore you to find an alternative solution beacause it just seems very wrong.
 
Thanx

I thank you for your suggestions and concerns
 

Users who are viewing this thread

Back
Top Bottom