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 and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Using data in Access database in outlook forms



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 14th 06, 07:21 PM posted to microsoft.public.outlook.program_vba
Weatherman
external usenet poster
 
Posts: 5
Default Using data in Access database in outlook forms

Has anyone every accessed a MS Access Database using a combobox in an outlook
form? I am looking to have a combobox display a list of records that are in a
access databse on another server. A standard ADO recordset in the object does
not seem to work.

Ads
  #2  
Old April 15th 06, 09:37 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Using data in Access database in outlook forms

You can't use bound controls in an Outlook form, but accessing a recordset
using SQL and ADO and putting the data into a control works just fine. I've
used grid controls many time as well as combo and list boxes. Get the
recordset and iterate it, putting the data into the appropriate rows of the
combo.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Weatherman" wrote in message
...
Has anyone every accessed a MS Access Database using a combobox in an
outlook
form? I am looking to have a combobox display a list of records that are
in a
access databse on another server. A standard ADO recordset in the object
does
not seem to work.


  #3  
Old April 17th 06, 05:02 PM posted to microsoft.public.outlook.program_vba
Weatherman
external usenet poster
 
Posts: 5
Default Using data in Access database in outlook forms

Thanks Ken, it's something in my connection string. I am opening a recordset
but it has a 0 count. I see that the query and table in access have record
locks and I am not getting any errors in VBA. Outlook can pull data from
access so I can eliminate that a possable cause.

"Ken Slovak - [MVP - Outlook]" wrote:

You can't use bound controls in an Outlook form, but accessing a recordset
using SQL and ADO and putting the data into a control works just fine. I've
used grid controls many time as well as combo and list boxes. Get the
recordset and iterate it, putting the data into the appropriate rows of the
combo.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Weatherman" wrote in message
...
Has anyone every accessed a MS Access Database using a combobox in an
outlook
form? I am looking to have a combobox display a list of records that are
in a
access databse on another server. A standard ADO recordset in the object
does
not seem to work.



  #4  
Old April 17th 06, 06:34 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Using data in Access database in outlook forms

Are you getting any errors when you set up your connection? How are you
doing it, a connect string or a DSN?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Weatherman" wrote in message
...
Thanks Ken, it's something in my connection string. I am opening a
recordset
but it has a 0 count. I see that the query and table in access have
record
locks and I am not getting any errors in VBA. Outlook can pull data from
access so I can eliminate that a possable cause.


  #5  
Old April 18th 06, 10:11 PM posted to microsoft.public.outlook.program_vba
Weatherman
external usenet poster
 
Posts: 5
Default Using data in Access database in outlook forms

I'm using a string connection, 'strDBPath = "S:\space2003.mdb"' I had no
errors when in the general declaration of the form and can confirm that it is
opening the database and running the query I am requesting it to. BUT I left
out rs.movelast, movefirst statements. SMALL over sight. I have it in a
module now and get a Rowset Does Not Support Fetching backward or Operation
not available Error if I rem it out. the code is below, I'm missing a step
somewhere.

Public NRTCC As ADODB.Connection

Private Sub cmbRoomList_Click()
On Error GoTo RoomListClickErr
Dim qryRoom As String
Dim RoomIDrs As ADODB.recordset
Dim i As Integer
' Set string path to DB
strDBPath = "\\bach\Center Space\space2003.mdb"
'opens connection
Set NRTCC = New ADODB.Connection
With NRTCC
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strDBPath
End With

Set RoomIDrs = New ADODB.recordset
With RoomIDrs
.CursorType = AdOpenForwardOnly
.locktype = adLockReadOnly
.ActiveConnection = NRTCC
End With

' qryRoom declareation and execution
qryRoom = "select * from qryConfRooms"
RoomIDrs.Open qryRoom

RoomIDrs.MoveLast
RoomIDrs.MoveFirst
' ****breaks at this point****
' Set combobox data source

cmbRoomList.Clear

For i = 0 To RoomIDrs.RecordCount - 1
cmbRoomList.AddItem RoomIDrs.Fields("fldBuilding" & "/"
& "fldRoom")
RoomIDrs.MoveNext
Next i



RoomListClickErr:
'basic errmessage
pstrMessage = "Cannot perform operation" & _
Chr(vbKeyReturn) & " Error # '" & _
Err.Number & ": " & Err.Description
MsgBox pstrMessage, vbExclamation, _
"NRTCMS Property & Support Services - Database Error"

End Sub


"Ken Slovak - [MVP - Outlook]" wrote:

Are you getting any errors when you set up your connection? How are you
doing it, a connect string or a DSN?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Weatherman" wrote in message
...
Thanks Ken, it's something in my connection string. I am opening a
recordset
but it has a 0 count. I see that the query and table in access have
record
locks and I am not getting any errors in VBA. Outlook can pull data from
access so I can eliminate that a possable cause.



  #6  
Old April 19th 06, 12:13 AM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Using data in Access database in outlook forms

..CursorType = AdOpenForwardOnly

That means you can only move forward in the cursor. Set a different cursor
type or only move to the start of the cursor, not the end.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Weatherman" wrote in message
...
I'm using a string connection, 'strDBPath = "S:\space2003.mdb"' I had no
errors when in the general declaration of the form and can confirm that it
is
opening the database and running the query I am requesting it to. BUT I
left
out rs.movelast, movefirst statements. SMALL over sight. I have it in a
module now and get a Rowset Does Not Support Fetching backward or
Operation
not available Error if I rem it out. the code is below, I'm missing a
step
somewhere.

Public NRTCC As ADODB.Connection

Private Sub cmbRoomList_Click()
On Error GoTo RoomListClickErr
Dim qryRoom As String
Dim RoomIDrs As ADODB.recordset
Dim i As Integer
' Set string path to DB
strDBPath = "\\bach\Center Space\space2003.mdb"
'opens connection
Set NRTCC = New ADODB.Connection
With NRTCC
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strDBPath
End With

Set RoomIDrs = New ADODB.recordset
With RoomIDrs
.CursorType = AdOpenForwardOnly
.locktype = adLockReadOnly
.ActiveConnection = NRTCC
End With

' qryRoom declareation and execution
qryRoom = "select * from qryConfRooms"
RoomIDrs.Open qryRoom

RoomIDrs.MoveLast
RoomIDrs.MoveFirst
' ****breaks at this point****
' Set combobox data source

cmbRoomList.Clear

For i = 0 To RoomIDrs.RecordCount - 1
cmbRoomList.AddItem RoomIDrs.Fields("fldBuilding" & "/"
& "fldRoom")
RoomIDrs.MoveNext
Next i



RoomListClickErr:
'basic errmessage
pstrMessage = "Cannot perform operation" & _
Chr(vbKeyReturn) & " Error # '" & _
Err.Number & ": " & Err.Description
MsgBox pstrMessage, vbExclamation, _
"NRTCMS Property & Support Services - Database Error"

End Sub


  #7  
Old April 20th 06, 12:46 AM posted to microsoft.public.outlook.program_vba
Weatherman
external usenet poster
 
Posts: 5
Default Using data in Access database in outlook forms

Thanks, keyset works.

"Ken Slovak - [MVP - Outlook]" wrote:

..CursorType = AdOpenForwardOnly

That means you can only move forward in the cursor. Set a different cursor
type or only move to the start of the cursor, not the end.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Weatherman" wrote in message
...
I'm using a string connection, 'strDBPath = "S:\space2003.mdb"' I had no
errors when in the general declaration of the form and can confirm that it
is
opening the database and running the query I am requesting it to. BUT I
left
out rs.movelast, movefirst statements. SMALL over sight. I have it in a
module now and get a Rowset Does Not Support Fetching backward or
Operation
not available Error if I rem it out. the code is below, I'm missing a
step
somewhere.

Public NRTCC As ADODB.Connection

Private Sub cmbRoomList_Click()
On Error GoTo RoomListClickErr
Dim qryRoom As String
Dim RoomIDrs As ADODB.recordset
Dim i As Integer
' Set string path to DB
strDBPath = "\\bach\Center Space\space2003.mdb"
'opens connection
Set NRTCC = New ADODB.Connection
With NRTCC
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strDBPath
End With

Set RoomIDrs = New ADODB.recordset
With RoomIDrs
.CursorType = AdOpenForwardOnly
.locktype = adLockReadOnly
.ActiveConnection = NRTCC
End With

' qryRoom declareation and execution
qryRoom = "select * from qryConfRooms"
RoomIDrs.Open qryRoom

RoomIDrs.MoveLast
RoomIDrs.MoveFirst
' ****breaks at this point****
' Set combobox data source

cmbRoomList.Clear

For i = 0 To RoomIDrs.RecordCount - 1
cmbRoomList.AddItem RoomIDrs.Fields("fldBuilding" & "/"
& "fldRoom")
RoomIDrs.MoveNext
Next i



RoomListClickErr:
'basic errmessage
pstrMessage = "Cannot perform operation" & _
Chr(vbKeyReturn) & " Error # '" & _
Err.Number & ": " & Err.Description
MsgBox pstrMessage, vbExclamation, _
"NRTCMS Property & Support Services - Database Error"

End Sub



 




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
Keep an online copy of you Outlook data that you can synchronize across several locations and access it via web broswers [email protected] Outlook - General Queries 1 April 13th 06 05:43 AM
How to import data in self created forms? Oliver Burkhardt Outlook - Using Contacts 1 April 4th 06 02:00 PM
how do i create a database in access ogaz Outlook - General Queries 1 March 22nd 06 05:55 AM
outlook and access data integration David Outlook - Using Forms 0 February 27th 06 03:22 PM
Can custom form data populate access database jbtempe Outlook - Using Forms 1 January 20th 06 03:02 PM


All times are GMT +1. The time now is 03:33 PM.


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.