A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Populate a combo box



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 14th 06, 12:13 PM posted to microsoft.public.outlook.program_forms
Steffkm
external usenet poster
 
Posts: 3
Default Populate a combo box

Sorry for opening the umpteenth thread to this topic, but after three
days googling for every keyword imaginable, i didn't get useful
results.
I want:
....To populate a combo box on a Outlook 2K3 form with data from an
Access 2K3 Database using VBA
I have:
.... Working VBA-code that allow me to get my data from Access
.... Working VBS-code, that allow me to populate my combo box
.... No idea how to put these two together in one VBA subroutine

I am familiar with VBA in Acccess, I wouldn't have much problems doing
that task in a form there but with Outlook, I have no clues...
If someone could be so kind and maybe just point me to the correct
objects that have to be used, I would be very grateful!

Greetings,
Stefan

  #2  
Old March 14th 06, 01:22 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Populate a combo box

Are you sure VBA is what you want? The usual approach is to put code to handle any UI tasks like that in the VBScript code behind the form, in the Item_Open event handler. It sounds like all you need to do is adapt your VBA code to the VBScript environment by removing any typed variable declarations, declaring constants as needed, etc.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Steffkm" wrote in message oups.com...
Sorry for opening the umpteenth thread to this topic, but after three
days googling for every keyword imaginable, i didn't get useful
results.
I want:
...To populate a combo box on a Outlook 2K3 form with data from an
Access 2K3 Database using VBA
I have:
... Working VBA-code that allow me to get my data from Access
... Working VBS-code, that allow me to populate my combo box
... No idea how to put these two together in one VBA subroutine

I am familiar with VBA in Acccess, I wouldn't have much problems doing
that task in a form there but with Outlook, I have no clues...
If someone could be so kind and maybe just point me to the correct
objects that have to be used, I would be very grateful!

Greetings,
Stefan

  #3  
Old March 14th 06, 04:42 PM posted to microsoft.public.outlook.program_forms
Steffkm
external usenet poster
 
Posts: 3
Default Populate a combo box

Thank you for your fast response! The problem is: I simply don't know,
how to adapt my VBA code to VBS!

The code is as follows:
Sub GetData()
Dim db As Database
Dim rs As Recordset
Dim i As Integer

Set db = OpenDatabase("c:\database.mdb")
Set rs = db.OpenRecordset("Query", dbOpenSnapshot)

i = 0
Do Until rs.EOF
Debug.Print rs.Fields("Name")
rs.MoveNext
i = i + 1
Loop
End Sub

If I put this bluntly in my Item_Open() script, I the script throws an
error.

Stefan

  #4  
Old March 14th 06, 04:50 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Populate a combo box

I gave you the basics in my earlier post:

" ... adapt your VBA code to the VBScript environment by removing any typed variable declarations, declaring constants as needed, etc."

A typed variable declaration is like this:

Dim db As Database

You must change it to:

Dim db

dbOpenSnapshot is a constant not intrinsic to VBScript. You must declare it as a constant or replace dbOpenSnapshot with its literal value.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Steffkm" wrote in message oups.com...
Thank you for your fast response! The problem is: I simply don't know,
how to adapt my VBA code to VBS!

The code is as follows:
Sub GetData()
Dim db As Database
Dim rs As Recordset
Dim i As Integer

Set db = OpenDatabase("c:\database.mdb")
Set rs = db.OpenRecordset("Query", dbOpenSnapshot)

i = 0
Do Until rs.EOF
Debug.Print rs.Fields("Name")
rs.MoveNext
i = i + 1
Loop
End Sub

If I put this bluntly in my Item_Open() script, I the script throws an
error.

Stefan

  #5  
Old March 14th 06, 08:28 PM posted to microsoft.public.outlook.program_forms
Steffkm
external usenet poster
 
Posts: 3
Default Populate a combo box

What more can I say than: It works!!!

Thank you very much!

Stefan

 




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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate combobox with public folder contact Pazuzu Outlook - Using Forms 4 March 15th 06 10:27 AM
Update TO field based on combo box selection Lisa Outlook - Using Forms 0 March 2nd 06 04:42 PM
Populate Control Boxes spydog27 Outlook - Using Forms 0 February 14th 06 11:48 PM
Dropdown controls - List vs Combo Don Smith Outlook - Using Forms 2 January 20th 06 06:46 PM
How to display PO Box field in Business Address Box from contact Sue Mosher [MVP-Outlook] Outlook - Using Contacts 0 January 18th 06 05:01 PM


All times are GMT +1. The time now is 05:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.