Default Values Disappear (1 Viewer)

swarm6

Registered User.
Local time
Yesterday, 19:10
Joined
May 9, 2012
Messages
12
In Access 2010 I have a Data Entry Form on which I have an unbound textbox in the header that the user can put a default date in. In the body of the form is a bound textbox that records the date and the default value is set as =defaultdatestat (obviously the name of the box in the header).

Problem: The default date shows up perfectly until a value is put in any of the other text boxes.

For further info:
If you put values in text boxes default value disappears; if you then push escape the default value reappears when the values in the text boxes disappear.

Help please? :banghead:
 

JHB

Have been here a while
Local time
Today, 04:10
Joined
Jun 17, 2012
Messages
7,732
What if you set the default value for the bound control, in the AfterUpdate event, (remove =defaultdatestat).

Code:
Private Sub YourControlNameWhereYouInputTheDefaultValue _AfterUpdate()
  Me.YourBoundControlName.DefaultValue =  "'" & Me.YourControlNameWhereYouInputTheDefaultValue & "'"
End Sub
 

swarm6

Registered User.
Local time
Yesterday, 19:10
Joined
May 9, 2012
Messages
12
Thank you, JHB. That got me on the right track. I tweaked it a little. I used "SetValue" in the after update of the first text box to be entered. I also have the default in the property so the user can see the default will work.

I would still prefer it to work the regular way because if the user wants to override the default date, they have to do it after the first textbox has been updated.
 

swarm6

Registered User.
Local time
Yesterday, 19:10
Joined
May 9, 2012
Messages
12
Anyone else have a suggestion of why it is not working as it should?
 

swarm6

Registered User.
Local time
Yesterday, 19:10
Joined
May 9, 2012
Messages
12
New information! Don't give up on me now :)

When I leave form view and go to design view and back the form works correctly. What happens when I go to design view and back that would trigger this response?

I have tried saving the form while it is working, but when I open it afresh it does not work again.

Help?
 

Users who are viewing this thread

Top Bottom