PDA

View Full Version : Solved: Combo Box & Date Formatting



twotinners
06-05-2006, 03:33 PM
Hello all:

I have 2 real dumb questions -

1. How do I format the date in a word field where the user would enter the U.S. date of 122706 would but the output would be 12/27/06 ?

2. I made a userform for a form field to overcome the 25 list limit for a combo box in a form. I have a list of about 75 items that won't change but the user must select OR have the ability to leave blank.

Suggestions? I have been banging my head and have bought 2 huge VB books in the past week but still can't figure it out.

Any and all assistance is highly appreciated. :banghead:

Dave

fumei
06-05-2006, 06:37 PM
No such thing, really, as dumb questions.


2. I made a userform for a form field to overcome the 25 list limit for a combo box in a form. I have a list of about 75 items that won't change but the user must select OR have the ability to leave blank. I don't understand. If this is on a userform, then one of the selection choices is...blank. So the value will be, one of the selected items, OR blank.

1. What kind of a field? Is the user entering the date directly into the field?

twotinners
06-05-2006, 06:45 PM
It's actually a 2 part question.... sorry for the confusion.

I'm trying to overcome the 25 line limit in a drop down box in a form. I've read that the only way to do that is by using a user form. The list will only contain text. I created the userform with a combo box but don't know how to add the data and keep the data in the drop down box. I want to keep the data in the form instead of referencing a database or anything else. The data won't change. Can I keep all this info IN the form or user form so the user can make a selection from a large list and the document is updated with the user's selection ?

the other seperate question was how do I display 12/27/06 in a data field if the user only has to enter 122706 ?

thanks for all your help

fumei
06-06-2006, 12:21 AM
One thing at a time.

but don't know how to add the data and keep the data in the drop down box.Are you asking how to fill the combobox? Use the .Add method of the combobox.

Normally you add items to the combobox in the Intialize event of the userform. There are other possibilities, but that is the "normal" event to use. If you are ever REpopulating the combobox (which happens) then you would use a different event. In any case, if this is what you are asking then:Sub UserForm1_Initialize()
Combobox1.Add "Keep Blank"
Combobox1.Add "Blah blah 1"
Combobox1.Add "Blahe blahe 2"
Combobox1.Add "Bhjty nnlasdj 3"
Combobox1.ListIndex = 0
End SubOK. This populates combobox1 with the items - the order added. The opening displayed item is item 0 ("Keep Blank").

Now you COULD simply have:Combobox1.Add "" which would have the item AS blank. Or you could have it, as I have done, as an explicitly blank. If selected, you could then convert "Keep Blank" to "" - which IS blank.

The list you use to populate can stay, will stay, in the userform. You can of course populate from elsewhere, but it certainly can live in the form.

twotinners
06-06-2006, 08:30 AM
Thank you very much. I'm new to the VB side of the house and it's been very confusing. I can make some awesome looking forms and am pretty darn good in PowerPoint, ... but this VB stuff is not as straight forward as I thought it was going to be.

Thanks again from the "VB Newbie"

fumei
06-06-2006, 07:05 PM
but this VB stuff is not as straight forward as I thought it was going to be.

LOL! You are in for a ride my friend.