Form problem

cbearden

Registered User.
Local time
Today, 10:34
Joined
May 12, 2004
Messages
84
I am having a problem when I enter data into my form. I have two controls that are currency and 1 that is date/time. If the first currency control is 0 or null, then both the others are disabled. If I enter 0 or delete the default "$0.00" in the first control, the 2nd control will show "$0.00" and the date/time control will show 12:00:00 AM. The settings for these controls are:

Currency Control(2nd control)
Format : Currency
Default Value : =Null

Date/Time Control
Format : Short Date
Default Value : =Null

Any help would be appreciated.
 
I would not recommend using Null as a default. Do not set a default at all. What sort of code is behind the 1st Currency control?
 
The reason I set the default values is b/c of this problem. But it didn't help.

Code for 1st control:
After_Update
-----------------
Me!curGrefund.Enabled = Nz(Me!curGcost, 0) <> 0
If Me!curGrefund.Enabled = False Then
Me!curGrefund = False
End If
Me!dtmGrec.Enabled = Nz(Me!curGcost, 0) <> 0
If Me!dtmGrec.Enabled = False Then
Me!dtmGrec = False
End If

Form
Current
---------------------
Me!curCLrefund.Enabled = Nz(Me!curCLcost, 0) <> 0
Me!dtmCLrec.Enabled = Nz(Me!curCLcost, 0) <> 0

Me!curGrefund.Enabled = Nz(Me!curGcost, 0) <> 0
Me!dtmGrec.Enabled = Nz(Me!curGcost, 0) <> 0

Me!curSCrefund.Enabled = Nz(Me!curSCcost, 0) <> 0
Me!dtmSCrec.Enabled = Nz(Me!curSCcost, 0) <> 0

Me!curOrefund.Enabled = Nz(Me!curOcost, 0) <> 0
Me!dtmOrec.Enabled = Nz(Me!curOcost, 0) <> 0

Me!curMPPrefund.Enabled = Nz(Me!curMPPcost, 0) <> 0
Me!dtmMPPrec.Enabled = Nz(Me!curMPPcost, 0) <> 0


NOTE: Just use the 4 and 5 line of code in the Form section for the 1st control.
 
Code:
Me!curGrefund.Enabled = Nz(Me!curGcost, 0) <> 0
If Me!curGrefund.Enabled = False Then
[B]Me!curGrefund = False[/B]
End If
Me!dtmGrec.Enabled = Nz(Me!curGcost, 0) <> 0
If Me!dtmGrec.Enabled = False Then
[B]Me!dtmGrec = False[/B]
End If
False is really equal to numeric zero (0) so this code is designed to do exactly as you described. I believe there is probably something wrong with both Bold lines since it is unlikely you want to set a TextBox or a DateField to False. Why not describe what you would like to happen and maybe we can help.
 
Last edited:
Here's what I am trying for...
If I put $0.00 into the 1st control, then 2nd and 3rd control will display nothing.
But 2nd control is showing $0.00 and the 3rd is showing 12:00:00AM
I don't have a problem with the 2nd control displaying $0.00 but the date is bothersome. It would be fine if it displayed the date when the record was added.
 
Just change the False to a zero length string ""
 
I changed it to Null and it worked. is "" better than Null?
 
It depends on the situation. In almost all cases, "" works where Null might throw an error. Your choice.
 

Users who are viewing this thread

Back
Top Bottom