if field blank

bseche

Registered User.
Local time
Today, 03:45
Joined
Aug 13, 2001
Messages
26
I have a database that keeps tracks of files and if the files are old then we close them and send it to storage.
I have a field in a database call [Box number] if box number is blank on existing record i want it to go to another field called [storage] and enter "not stored" i don't want this to change for all record only on current record. Once the user enter a box number i want the database to go back to [storage field] and delete "not stored" i did a code but it seems that it keep setting it up for all the record.
 
If (IsNull(me.BoxNumber)) Then
me.Storage = "Not Stored"
End If

Did your code look like this?

[This message has been edited by Accessable (edited 01-17-2002).]
 
Very neat trick for text fields that may be blank:
In the Form field:
Format: @;"Not stored"

This doesn't actually store the words "Not stored" in the field, it just displays them when nothing else is there.
It saves you from having an inefficient Text field dedicated to what is essentially a boolean value: Stored/Not Stored.

If that's not the aim behind this, there are other options but it would help to know more about what you're trying to do.
Hint: If you're trying to change the value of [StorageField] based on the value of [BoxNumber], put your code in the AfterUpdate event of [BoxNumber].

HTH,
David R
 
There is a similar code for number format fields: 0;(0);;"No value"
 
Hi sorry i'm replying late i was at a conference.

Let me tell you about the program maybe that would help you to help me.
This program is for a law firm.
Once the case is closed they have alot of files they want to be stored away for later.
When they have a new client they go in the program and enter all the clients infomation. They don't enter a box number in the box number field in the begining because the case is not closed.
I have a field in a database call [Box number] if box number is blank on existing record i want it to go to another field called [storage] and enter "not stored" i don't want this to change for all record only on current record. Once the user enter a box number i want the database to go back to [storage field] and take out "not stored"

Please let me know if i gave enough info
Thank you
 
If I understand correctly, the [Storage field] will always equal "Not Stored" if the [Box number] field is blank, and will always equal "Stored" if the [Box number] field is populated.

If this is the case, you probably shouldn't store the field in your database. It would be easier to calculate it as part of a query.

If you create a query based on the table in question, and add the following into a blank column of the Query Window, you should get the result you are after:

Storage Status: IIf(IsNull(Box Number], "Not Stored","Stored")

By doing this, the field is now calculated rather than stored, so you never have to worry about trying to keep it up to date.

HTH
SteveA
smile.gif
 

Users who are viewing this thread

Back
Top Bottom