Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why can't I set a default value with code? 1

Status
Not open for further replies.

projecttoday

Programmer
Joined
Feb 28, 2004
Messages
208
Location
US
I have a form with a text box which is bound to a table field which is a text field. If I set a default value for this field on the properties it shows up correctly for a new record but if I set a default value with code I get #Name for a new record. What am I missing as far as setting default values in code?
 
if I set a default value with code
Which code ?
Seems like you've missed quotes for a text default value.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
post your code

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
This is just one example:

Me.fld1.DefaultValue = "ccc"

fld1 is both a field name and a textbox name. No matter what I try, it doesn't work but it works it I put it in in the data tab.
 
The next time you post, please show your code so we know what you tried. I would try change your code to:

Code:
   Me.fld1.DefaultValue = """ccc"""

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top