PC Review


Reply
Thread Tools Rate Thread

unique record identifier

 
 
=?Utf-8?B?cmFq?=
Guest
Posts: n/a
 
      2nd Aug 2007
I am trying to link oracle tables from an ODBC database to access in VBA
code. I have a small problem though, some of the tables do not have a primary
key and I keep getting a prompt to "select a Unique Record Identifier". Is
there a way to programmatically select all the fields?
 
Reply With Quote
 
 
 
 
Stefan Hoffmann
Guest
Posts: n/a
 
      2nd Aug 2007
hi Raj,

raj wrote:
> I am trying to link oracle tables from an ODBC database to access in VBA
> code. I have a small problem though, some of the tables do not have a primary
> key and I keep getting a prompt to "select a Unique Record Identifier".

This should never be the case, as it is very poor database design.

> Is there a way to programmatically select all the fields?

Use

With CurrentDb
.TableDefs.Append _
.CreateTableDef(..)
.TableDefs.Requery
End With

to create your linked table without prompting. Then you can use
..TableDefs("yourTable").Fields to enumerate all your fields.


mfG
--> stefan <--
 
Reply With Quote
 
=?Utf-8?B?cmFq?=
Guest
Posts: n/a
 
      2nd Aug 2007
Hi Stefan,

Thanks for your reply.

I tried your suggetion.

With CurrentDb
.TableDefs.Append .CreateTableDef("LOAN", dbAttachSavePWD, .....)
.TableDefs.Refresh
For I = 0 To .TableDefs("LOAN").Fields.count - 1
.TableDefs("LOAN").Fields.Append (.TableDefs("LOAN").Fields)
Next I
end with

But i get error 'argument not optional' for 'Fields'. Please let me know how
to loop through and enumerate all the fields.

Also .tabledefs.requery does not work, i have only 4 options in .tabledefs,
they are
Append, Count, Delete, Refresh.

thanks in advance, raj

"Stefan Hoffmann" wrote:

> hi Raj,
>
> raj wrote:
> > I am trying to link oracle tables from an ODBC database to access in VBA
> > code. I have a small problem though, some of the tables do not have a primary
> > key and I keep getting a prompt to "select a Unique Record Identifier".

> This should never be the case, as it is very poor database design.
>
> > Is there a way to programmatically select all the fields?

> Use
>
> With CurrentDb
> .TableDefs.Append _
> .CreateTableDef(..)
> .TableDefs.Requery
> End With
>
> to create your linked table without prompting. Then you can use
> ..TableDefs("yourTable").Fields to enumerate all your fields.
>
>
> mfG
> --> stefan <--
>

 
Reply With Quote
 
Stefan Hoffmann
Guest
Posts: n/a
 
      2nd Aug 2007
hi Raj,

Dim Fields As String
> With CurrentDb
> .TableDefs.Append .CreateTableDef("LOAN", dbAttachSavePWD, .....)
> .TableDefs.Refresh

Fields = ""
> For I = 0 To .TableDefs("LOAN").Fields.count - 1

Fields = Fields & .TableDefs("LOAN").Fields.Item(I).Name & ",
"
> Next I

Execute "CREATE INDEX pk_LOAN ON LOAN(" & Fields & _
") WITH PRIMARY;"
> end with



mfG
--> stefan <--
 
Reply With Quote
 
=?Utf-8?B?cmFq?=
Guest
Posts: n/a
 
      3rd Aug 2007
Hi Stefan,

Thankyou very much. Your answer is great.

raj

"Stefan Hoffmann" wrote:

> hi Raj,
>
> Dim Fields As String
> > With CurrentDb
> > .TableDefs.Append .CreateTableDef("LOAN", dbAttachSavePWD, .....)
> > .TableDefs.Refresh

> Fields = ""
> > For I = 0 To .TableDefs("LOAN").Fields.count - 1

> Fields = Fields & .TableDefs("LOAN").Fields.Item(I).Name & ",
> "
> > Next I

> Execute "CREATE INDEX pk_LOAN ON LOAN(" & Fields & _
> ") WITH PRIMARY;"
> > end with

>
>
> mfG
> --> stefan <--
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Unique Record Identifier BruceF Microsoft Access VBA Modules 2 1st Feb 2010 07:40 PM
Select Unique Record Identifier BruceF Microsoft Access VBA Modules 0 1st Feb 2010 05:42 PM
Re: Unique Record Identifier Roger Carlson Microsoft Access VBA Modules 0 16th Oct 2008 06:27 PM
linking to SQL and unique record identifier Support Microsoft Access External Data 1 5th Mar 2004 02:09 AM
Unique record identifier alternatives dave chaffee Microsoft Dot NET Compact Framework 1 3rd Nov 2003 12:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:58 PM.