Re: Error Message when using ODBC: " Record <n> had too few data f



>From what you describe, I'd guess you are probably actually using the OLEDB
provider, not the ODBC driver. Are you asked to save a .odc file at some
point? If so, it's OLEDB.

Unfortunately I no longer have an Oracle set-up to experiment with here and
the following is rather complicated, but this is what I would probably do:
a. if my connection used a .odc file, open the .odc file using Notepad and
look at the connection string. (Note that it is in an "HTML" format). Does
it contain your login information? If it does not, try editing the file to
include the login information and try again. If it does, then this approach
is probably not going to work. You can try to open the data source using a
VBA OpenDataSource statement instead. In that case, I would
- copy the connection string and de-HTML it. The resulting string needs to
have a maximu length of 255 characters. If you need to shorten it, there
are usually plenty of parameters you do not need to set
- use Notepad to create a completely empty .odc file, e.g. called
blank.odc. Let's suppose its pathname is c:\myodcs\blank.odc
- create a Word VBA macro that calls OpenDataSource, e.g.

Sub OpenOracle()
ActiveDocument.MailMerge.OpenDataSource _
Name:="c:\mydocs\blank.odc", _
Connection:="the connection string you took from the .odc", _
SQLStatement:="SELECT * FROM tablename"
End Sub

You need to modify the SQL to suit your application.

Make you mail merge main document your active document, run the macro, and
see what happens.

b. If my guess is wrong and you are using ODBC, did you try OLEDB?
c. If you cannot make OLEDB work or were trying to use ODBC anyway, I
suspect that you will need to use VBA anyway, because login security info.
is not normally retained when you create ODBC connections however you do it.
To use ODBC, you will need an ODBC DSN for your Oracle connection - in
recent versions of Windows you can create one in Control
Panel|Administrative Tools||ODBC Administrator. Normally you need a User or
System DSN, but it can be useful to create a File DSN because you can open
the resulting DSN in Notepad and use the contents to help you create a
connection string for Word.

Once you have created your User/System DSN, there are two ways you can try
to connect:
- go through the Select Data Source dialog, and go via MS Query (it's in
the Tools menu at the top right of the dialog). Follow the steps in there.
Before you return the data to Word, I suggest you save the query as a .dqy
file as that can also be opened in Notepad and give you information about
what should be in the connection string. My guess is that if this works, you
will see the data when it is first returned, but after that you will see
errors because the login security information has been discarded.
- use VBA. In this case you will need to construct your own connection
string. The first part needs be
DSN=dsnname;
where "dsnname" is the name of the user/system DSN
the rest can be constructed either using the info. in the .dqy or in the
..dsn file. Each parameter needs to be followed by a semicolon.

Then try

Sub OpenOracle()
ActiveDocument.MailMerge.OpenDataSource _
Name:="", _
Connection:="DSN=dsnname;the rest of the connection string you
constructed", _
SQLStatement:="SELECT * FROM tablename", _
Subtype:=wdMergeSubtypeWord2000
End Sub

I hope at least one of those approaches gets you somewhere. If not, another
thing you can try if you happen to have Access is to use Access to link to
your Oracle table/.view, and use the resulting Access table as your
datasource.

Peter Jamieson

"Pat" <Pat@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2D52CE5D-889B-412A-860C-431D288A1AA0@xxxxxxxxxxxxxxxx
> Hi, thanks for responding. 1. the version is Word 2002 on XP. 2. using
> Microsoft's Oracle Driver....when the data connection wizard appears, I
> choose 'Oracle'. 3. system 4. Yes, I see a checkbox that saves 'allow
> saving password'. when checked I get the same error.
>
> Thanks in advance for any suggestions.
> Pat
>
> "Peter Jamieson" wrote:
>
>> Which version of Word?
>>
>> Whose ODBC driver are you using? Oracle's, or Microsoft's?
>>
>> Did you already have an ODBC DSN defined for Oracle? If so, which type
>> (User/System/File) ?
>>
>> Did you see any options that asked whether security information
>> (login/password) should be saved? If so, you probably need to select
>> those
>> options.
>>
>> Peter Jamieson
>>
>> "Patrice" <Patrice@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:778F0D4D-423D-40A8-AF57-8DF89E85188B@xxxxxxxxxxxxxxxx
>> >I am trying to connect to an Oracle database thru Word. The connection
>> > wizard allows me to sign onto the database and pick which table I need.
>> > However, after I choose 'open source', the above error message is
>> > received
>> > and nothing from the table is displayed. Any help or guidance would be
>> > greatly appreciated.
>> >
>> > Thanks!
>>
>>
>>


.



Relevant Pages

  • Re: VFP Updates?
    ... Try talking ODBC or OleDb and they say HU. ... make up my apps so that what ever they want to run has to be from a command ... kind of connection and assign it the right to do exactly what you want. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Alternative to using DSN to connect to database
    ... you have to use .NET ODBC provider. ... Server is NOT optimized. ... Just because of the Admiistrator thinking DSN is easier for him to control ... > Basically my problem is that the ODBC Connection Manager in Control Panel ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Silly ODBC Connection problem
    ... it seems to me this must be done interactively on each client--either that or use the magical "DSN-less" connection. ... It's been 11 or years or so since I wrote about ODBC so it's getting kinda fuzzy. ... 556-9205 (Pacific time) ... > created a System DSN named "MyDSN" in the ODBC Administrator tool. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: VFP ODBC
    ... Could you tell me how to create an OLEDB connection in MS Access or SQL ... VFP6 then you WILL NOT be able to access them from ODBC. ... Save non-verified file DSN? ...
    (microsoft.public.fox.helpwanted)
  • Re: Alternative to using DSN to connect to database
    ... use a native driver where possible. ... Basically my problem is that the ODBC Connection Manager in Control Panel ... At present (since nearly all use the ODBC DSN Connection ...
    (microsoft.public.dotnet.framework.adonet)