ADO / SQL / MS Outlook E-Form

Posted on 2000-03-23
Last Modified: 2013-12-25
I am creating a form in outlook.
It stores the emailed data in a access data base.
The following code (Outlooks VB Script) gives me the error "Syntax error in FROM clause."

Set objRec = CreateObject "ADODB.Recordset")

Source = "SELECT * FROM OEMService WHERE ID = " & RecordNumber & " ORDER BY ID"

ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=d:\OEMdb.mdb"

objRec.Open Source, ConnStr, 2, 2, 2

Why is this error occuring &
How do I fix this?
Question by:Chrynoble
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 2650923
The first thing you need to do is to create Connection

Set objCon = CreateObject "ADODB.Connection"
Set objRec = CreateObject "ADODB.Recordset"

Source = "SELECT * FROM OEMService WHERE ID = " & RecordNumber & " ORDER BY ID"

ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=d:\OEMdb.mdb"

objCon.Open ConnStr
objRec.Open Source, ObjCon, 2, 2, 2


Accepted Solution

samopal earned 75 total points
ID: 2650925

Set objCon = CreateObject("ADODB.Connection")
Set objRec = CreateObject("ADODB.Recordset")


Author Comment

ID: 2661097
I can't test this right now, but it looks like you have solved a catch 22 for me.


Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question