Set Combo Box to default value

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

Guest

New to Access and I know very little about VBA, but I'm using a Combo Box to
lookup records and want it to reset to the default value when the field
looses focus. Can this be done best using VBA code? Thanks in advance!
 
On the Lost focus event of the combo try and write the code

me.ComboName = Me.ComboName.DefaultValue
 
That didn't seem to work, I get an error saying it can't find the macro
"me." Here is what I put for the Lost Focus event: me.Combo48 =
Me.Combo48.DefaultValue
 
When you are on the Lost focus peoperty, on the right you can see a button
with three dots, click on it, and select code view, and type this line in the
code section.

If you type this code strait in the box of the lost focus event, access will
look for a macro in this name
 
That worked, thanks!

Ofer said:
When you are on the Lost focus peoperty, on the right you can see a button
with three dots, click on it, and select code view, and type this line in the
code section.

If you type this code strait in the box of the lost focus event, access will
look for a macro in this name
 

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

Similar Threads

Default Value in a combo box on a form 2
reset combo box 1
Default Value in combo box 5
update combo box 6
Combo box default 7
Combo Box Help 7
Combo box questions 2
Populate combo box from current record 3

Back
Top