Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default drop down list boxes in excel


I have an excel sheet that is going to act like a form.
Is it possible to have 2 drop down list box.
The second list of selections change dynamically on what was selected
from the 1st list.
Both lists are pulled from an ORACLE database.

Can anyone point me in the right direction?

Thanks,


--
RycherX
------------------------------------------------------------------------
RycherX's Profile: http://www.excelforum.com/member.php...o&userid=34236
View this thread: http://www.excelforum.com/showthread...hreadid=539877

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default drop down list boxes in excel

RycherX, see if this will help,

http://www.contextures.com/xlDataVal02.html
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"RycherX" wrote in
message ...

I have an excel sheet that is going to act like a form.
Is it possible to have 2 drop down list box.
The second list of selections change dynamically on what was selected
from the 1st list.
Both lists are pulled from an ORACLE database.

Can anyone point me in the right direction?

Thanks,


--
RycherX
------------------------------------------------------------------------
RycherX's Profile:
http://www.excelforum.com/member.php...o&userid=34236
View this thread: http://www.excelforum.com/showthread...hreadid=539877



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default drop down list boxes in excel


I can't list the items by hand. They must be dynamically created from a
database connection. Is this still possible.
Sorry, I'm an excel newbie.


--
RycherX
------------------------------------------------------------------------
RycherX's Profile: http://www.excelforum.com/member.php...o&userid=34236
View this thread: http://www.excelforum.com/showthread...hreadid=539877

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default drop down list boxes in excel

I am using this code to do it:
Note you will need to add a reference to

(Your versions may differ)
Microsoft ActiveX Data Objects 2.8 Library


Option Explicit

Private Sub Workbook_Open() 'is run when workbook opens

Dim rsRef As ADODB.Recordset
Dim cnRef As ADODB.Connection
Dim sqlRef As String

'Instantiate objects
Set rsRef = New ADODB.Recordset
Set cnRef = New ADODB.Connection

cnRef.ConnectionString = "DSN={LOCAL-DSN};Uid={USER};Pwd={PASSWORD}"
cnRef.Open
'sqlRef = "Select * [OR Field List] FROM {DATA-TABLE}"
sqlRef = "Select * FROM {DATA-TABLE}" 'returns all fields and all records
sqlRef = "Select Field1, Field2 FROM {DATA-TABLE}" 'returns only Field1
and Field2 but ALL records
'Other options available with SQL - SELECT statement

rsRef.Open sqlRef, cnRef, adOpenStatic, adLockReadOnly
If rsRef.RecordCount 0 Then
frmInput.cboInput.Clear 'clears combo box
Load frmInput
rsRef.MoveFirst 'goes to first record
Do While Not rsRef.EOF 'do while records remain
' Next line adds items to combo box
frmInput.cboInput.AddItem rsRef.Fields("Field1").Value
rsRef.MoveNext 'moves to next record
Loop 'continues the loop
while records remain
frmInput.Show vbModal 'displays my form
End If

End Sub



--
Wendell A. Clark, BS
Nurses Unlimited, Inc.
432-550-1700 x126
-------------------------------------

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may
contain confidential and privileged information for the use of the
designated recipients named above. If you are not the intended recipient,
please notify us by reply e-mail. You are hereby notified that you have
received this communication in error and that any review, disclosure,
dissemination, distribution or copying of it or its contents is prohibited.
If you have received this communication in error, please destroy all copies
of this communication and any attachments. Contact the sender if it
continues.


"RycherX" wrote in
message ...

I can't list the items by hand. They must be dynamically created from a
database connection. Is this still possible.
Sorry, I'm an excel newbie.


--
RycherX
------------------------------------------------------------------------
RycherX's Profile:
http://www.excelforum.com/member.php...o&userid=34236
View this thread: http://www.excelforum.com/showthread...hreadid=539877



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
data validations - drop list boxes TLBauer Excel Discussion (Misc queries) 2 March 9th 08 05:52 PM
Using List Drop Boxes in Excel shellydd Excel Discussion (Misc queries) 1 September 26th 06 02:09 PM
List boxes, drop down Kevin Excel Discussion (Misc queries) 1 August 8th 05 01:31 PM
Creating Drop Down boxes with the List function... JeanneW Excel Discussion (Misc queries) 3 June 1st 05 02:59 PM
Using symbols for drop down list boxes? Sumeet Benawra Excel Worksheet Functions 0 April 19th 05 11:41 AM


All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"