Cannot set default values!

  • Thread starter Thread starter AshleyH
  • Start date Start date
A

AshleyH

Greetings:

I have a billing database that allows you to enter in new
contacts on a form. In Design View I set up certain
fields to have a default value (in my case, the default
value should be "ADT" without the quotes) in a drop-down
arrow menu. However, whenever the "Add New Record" button
is clicked, it clears the form to allow a new record to be
entered (as it should) but my default value is not
displayed. Is there some sort of underlying coding in
the "Add New Record" button that could be overriding my
Default Value setting for my fields? If so, how do I get
past this? By setting this default value I will save my
users COUNTLESS mouse clicks!

Thanks in advance!
 
on the AddNewRecord_Click in Visual Basic code add:
DropDownName.value = "ADT"
Where DropDownName is the name of the drop down box.

that should do it.

Kevin
 
I can't get that to work. Tell me if my syntax is off
target:

Private Sub AddRecord_Click()
Service.Value = "ADT"
End Sub

AddRecord is the name of the button, Service is the name
of the drop-down menu item I want to set to "ADT". I get
errors when I run it this way.

Thanks
 
It didn't work :(

It says that it can't find "Service" now but I know that
name is correct.
 
You need to give that combo box the focus first.

Try this:

With Service

.SetFocus
.Value = .DefaultValue

End With

This way, if you ever change the default value, this code
will still work properly.
 
Back
Top