Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > PC based Database Applications > Microsoft Excel > Dates as Numbers in Combo Box

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-19-08, 04:21
JezLisle JezLisle is offline
Registered User
 
Join Date: Apr 2007
Location: Stalybridge, Manchester
Posts: 240
Dates as Numbers in Combo Box

When I fill the Combo Box it shows as a date in the list for selecting in the Combo Box. Once I select the Date I want it then changes back to its number format.

I have tried using the code below and still no joy, where am I going wrong?

Code:
Private Sub cboGetDate_Change() cboGetDate.Text = CLng(Format(cboGetDate.Value, "dd/mm/yyyy")) End Sub

I have raised this thread in

http://www.excelforum.com/excel-prog...combo-box.html

and had no joy as yet...
Reply With Quote
  #2 (permalink)  
Old 09-19-08, 06:11
JezLisle JezLisle is offline
Registered User
 
Join Date: Apr 2007
Location: Stalybridge, Manchester
Posts: 240
I have changed the code to this below and now it seems to compile correctly but when selecting the date in the Combo Box it still shows as a date number and not as the date format.

where am I going wrong?

Code:
Private Sub cboGetDate_Change() Dim GetDate As Date If GetDate = CDate(cboGetDate.Value) Then cboGetDate.Value = Format(CDate(cboGetDate.Value), "dd/mm/yyyy") Else End If End Sub
Reply With Quote
  #3 (permalink)  
Old 09-19-08, 07:26
JezLisle JezLisle is offline
Registered User
 
Join Date: Apr 2007
Location: Stalybridge, Manchester
Posts: 240
I have tried this code below and all seems to be well, as it does what I was wanting :-)

Code:
Private Sub cboGetDate_Change() MyDate = Format(cboGetDate.Value, "dd/mm/yyyy") cboGetDate.Value = Format(MyDate, "dd/mm/yyyy") End Sub
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On