Connecting Tech Pros Worldwide Help | Site Map

Set Value of ComboBox in VBA

  #1  
Old January 7th, 2009, 09:45 PM
Newbie
 
Join Date: Nov 2008
Posts: 26
Hi all,

I have combo box where I can choose week number (but it show also start and end date(call week number)) and also have end date(called edate) combo box .

Now i want to something, when i will choose week number, end date will be show up in edate combo box.

Example: when i select "1" in week number combo box, otherbox (edate) will show 2009/01/04

is it possible?

Thank you.
Attached Thumbnails
attachment1.bmp   attachment2.jpg  
  #2  
Old January 8th, 2009, 02:36 PM
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,473
Provided Answers: 57

re: Set Value of ComboBox in VBA


To set the value of the ComboBox in VBA simply assign the required value to it :
Expand|Select|Wrap|Line Numbers
  1. Me.EDate = #4 Jan 2009#
As far as accessing the non-default value of a ComboBox is concerned, you can use the Column property (Don't specify Row parameter if you want to use the default (selected) row) :
Expand|Select|Wrap|Line Numbers
  1. Me.EDate = Me.[Week Number].Column(2)
NB. From your pictures, column 2 (3rd column) is not actually a date value, but a date/time value. This is likely to cause you problems unless you're careful.

PS. Please remember in future to provide a meaningful name for your question (See FAQ - Thread titles).
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling A Combobox Value in VBA Code beingnick answers 1 August 6th, 2007 06:33 AM
Update Query in VBA updates field to -1!? Riun answers 1 July 17th, 2007 08:36 PM
Error Trapping In Access 2000 Peter Frost answers 6 November 12th, 2005 11:14 PM
Error Trapping In Access 2000 Peter Frost answers 6 November 12th, 2005 10:50 PM