default value after update

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.
 
For some reason I am getting the value "0" returned.

An example of the data that is in there before update is "2007"
 
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
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top