No, that's not how you set a default in code. What you did was to actually assign the textbox a value. It just so happens the value is strDescription.
To set a default with code it's
Me.datacomboNAME.DefaultValue = strDescription
What's the difference?
If you use the .DefaultValue method like I did, then:
You're on the last record, say number 10.
You scroll forward to add a new record.
You start typing in a field.
Your new record, number 11, is created.
Your datacombo gets the default automatically.
OR
You're on the last record, say no. 10.
You scroll forward to add a new record.
You change your mind and scroll back.
Your new record, would have been no. 11, is NOT created.
You still have only 10 records.
If you do it your way.
You're on the last record, say number 10.
You scroll forward to add a new record.
Your datacombo has no default. You literally assign it a value.
You start typing in another field.
Your new record, number 11, is created.
OR
You're on the last record, say no. 10.
You scroll forward to add a new record.
Your datacombo has no default. You literally assign it a value.
You change your mind and scroll back.
Your new record, no. 11, is STILL created, but it only has one field filled out, i.e. the datacombo.
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
|