default value after update

F

Fipp

I am trying to set the default value for a number field to the current value
of that field on a form after update. Can anyone help me with that code. the
fields name is season.
 
D

Douglas J. Steele

Me!season.DefaultValue = Chr$(34) & Me!season & Chr$(34)

Even though it's a numeric field, DefaultValue is a text property, so needs
quotes around the value.
 
F

Fipp

For some reason I am getting the value "0" returned.

An example of the data that is in there before update is "2007"
 
D

Douglas J. Steele

You'll need to double-check that Me!season is returning what you think it
should be.

Private Sub season_AfterUpdate()

MsgBox "Season contains " & Me!season
Me!season.DefaultValue = Chr$(34) & Me!season & Chr$(34)
MsgBox "Default value set to " & Me!season.DefaultValue

End Sub
 
F

Fipp

That returns the following.

season contains 2007
default value set to "2007"

When I go to the design view and check the default value that is set in the
properties form it is 0
 
F

Fipp

Thanks, I found another piece of code with season in it that was messing it
up. Sorry for the trouble and I greatly appreciate your help. I like the way
you use the message box to find out what is being returned.
 
Top