retaining combo box entries

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

Guest

We have created a very basic (simple) data entry form with a drop down field
displaying month and year. How do we keep that entry on the form until
selecting a new month. Coding is not my strong point.
 
We have created a very basic (simple) data entry form with a drop down field
displaying month and year. How do we keep that entry on the form until
selecting a new month. Coding is not my strong point.

Well, it's only one line of code, so it shouldn't be too bad... <g>

Let's say the name of this combo is cboMonth. Open the form in design
view; view its Properties; select the combo box, and click the ...
icon next to the After Update property on the Events tab. Choose Code
Builder from the three options you'll be given. Access will put you
into the VBA editor with the Sub and End Sub lines already filled in.
Edit it to:

Private Sub cboMonth_AfterUpdate() << provided already
Me!cboMonth.DefaultValue = """" & Me!cboMonth & """"
End Sub << ditto

The """" is just one of the ways to store a quote character into a
string - the DefaultValue property must be a text string, hence the
need for the quotes.

John W. Vinson[MVP]
 

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


Back
Top