473,804 Members | 3,509 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Different BE database uniformity.

I have 1 FE database which can be linked to a number of BE databases. The
BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge Club,
Family etc.

Problem is if I change anything in the table structure or relationship of
one of these clubs, I want to make sure I do it with the other clubs as
well.
Has anyone got routine that will check that each BE database has
1) All the tables (even though some will be empty e.g. Bridge club has
nothing to do with boats)
2) The fields are all the same size, default values are the same, Indexes
are the same etc
3) Relationships are identical

I am struggling to do it manually at the moment and I know it is very error
prone

Thanks for any advise

Phil
Jul 25 '08 #1
14 1498
Any reason you can't combine the back-ends databases? Some table restructure
adding keys to identify the club would allow you to switch without
re-linking to a new back-end.

Otherwise, write some VBA code to make the changes, then run it on each
back-end.

"Phil Stanton" <ph**@myfamilyn ame.co.ukwrote in message
news:uY******** *************** *******@posted. plusnet...
I have 1 FE database which can be linked to a number of BE databases. The
BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge Club,
Family etc.

Problem is if I change anything in the table structure or relationship of
one of these clubs, I want to make sure I do it with the other clubs as
well.
Has anyone got routine that will check that each BE database has
1) All the tables (even though some will be empty e.g. Bridge club has
nothing to do with boats)
2) The fields are all the same size, default values are the same,
Indexes
are the same etc
3) Relationships are identical

I am struggling to do it manually at the moment and I know it is very
error
prone

Thanks for any advise

Phil


Jul 25 '08 #2
Phil Stanton wrote:
I have 1 FE database which can be linked to a number of BE databases. The
BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge Club,
Family etc.

Problem is if I change anything in the table structure or relationship of
one of these clubs, I want to make sure I do it with the other clubs as
well.
Has anyone got routine that will check that each BE database has
1) All the tables (even though some will be empty e.g. Bridge club has
nothing to do with boats)
2) The fields are all the same size, default values are the same, Indexes
are the same etc
3) Relationships are identical

I am struggling to do it manually at the moment and I know it is very error
prone

Thanks for any advise

Phil

Hi Phil. Here's a routine I made up. I created two tables;
TableCurrent and TableExternal. Three fields; TableName, FieldName,
FieldType. You could add FieldSize as well and add that in the Insert
statement and insert the Size property as well. Change the External mdb
name. Then run. After that you can create some queries to check for
differences between these two tables.

Sub CheckFieldDiffe rences()

Dim dbs As Database
Dim dbsExternal As Database
Dim wsp As Workspace
Dim tdf As TableDef
Dim fldCurrent As Field
Dim fldExternal As Field
Dim strSQL As String

Dim strExternal As String
strExternal = "C:\Test\Db1.MD B" 'CHANGE TO THE EXTERNAL FILE NAME

' Return reference to current database.
Set dbs = CurrentDb
' Return reference to default workspace.
Set wsp = DBEngine.Worksp aces(0)
' Return reference to External.mdb.
Set dbsExternal = wsp.OpenDatabas e(strExternal)

' Enumerate all TableDef objects in each database.
'Debug.print dbs.Name & ":"
For Each tdf In dbs.TableDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldCurrent In tdf.Fields
'Debug.print fldCurrent.Name , fldCurrent.Type
strSQL = "Insert Into TableCurrent (TableName,
FieldName, FieldType) Values " & _
"('" & tdf.Name & "', '" & fldCurrent.Name & "', "
& fldCurrent.Type & ")"
dbs.Execute strSQL
Next
End If
'Exit For
Next tdf
'Debug.print

'Debug.print dbsExternal.Nam e & ":"
For Each tdf In dbsExternal.Tab leDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldExternal In tdf.Fields
'Debug.print fldExternal.Nam e, fldExternal.Typ e
strSQL = "Insert Into TableExternal (TableName,
FieldName, FieldType) Values " & _
"('" & tdf.Name & "', '" & fldExternal.Nam e & "', "
& fldExternal.Typ e & ")"
dbs.Execute strSQL
Next
End If
Next tdf
Set dbs = Nothing

dbsExternal.Clo se
Set dbsExternal = Nothing
MsgBox "Done"

End Sub

Voqa Mosimosi
http://www.youtube.com/watch?v=EQJr1LUmfLM
Jul 25 '08 #3
Thanks Salad That looks great. Will try it tonight.
Probably refine it to have all the info for all the DBs in TblCurrent with a
pointer to which DB they come from. Should be very easy to compare

Any thoughts on the relationship part of my question?

Thanks again

Phil
"Salad" <oi*@vinegar.co mwrote in message
news:nI******** *************** *******@earthli nk.com...
Phil Stanton wrote:
>I have 1 FE database which can be linked to a number of BE databases. The
BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge Club,
Family etc.

Problem is if I change anything in the table structure or relationship of
one of these clubs, I want to make sure I do it with the other clubs as
well.
Has anyone got routine that will check that each BE database has
1) All the tables (even though some will be empty e.g. Bridge club
has nothing to do with boats)
2) The fields are all the same size, default values are the same,
Indexes are the same etc
3) Relationships are identical

I am struggling to do it manually at the moment and I know it is very
error prone

Thanks for any advise

Phil
Hi Phil. Here's a routine I made up. I created two tables; TableCurrent
and TableExternal. Three fields; TableName, FieldName, FieldType. You
could add FieldSize as well and add that in the Insert statement and
insert the Size property as well. Change the External mdb name. Then
run. After that you can create some queries to check for differences
between these two tables.

Sub CheckFieldDiffe rences()

Dim dbs As Database
Dim dbsExternal As Database
Dim wsp As Workspace
Dim tdf As TableDef
Dim fldCurrent As Field
Dim fldExternal As Field
Dim strSQL As String

Dim strExternal As String
strExternal = "C:\Test\Db1.MD B" 'CHANGE TO THE EXTERNAL FILE NAME

' Return reference to current database.
Set dbs = CurrentDb
' Return reference to default workspace.
Set wsp = DBEngine.Worksp aces(0)
' Return reference to External.mdb.
Set dbsExternal = wsp.OpenDatabas e(strExternal)

' Enumerate all TableDef objects in each database.
'Debug.print dbs.Name & ":"
For Each tdf In dbs.TableDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldCurrent In tdf.Fields
'Debug.print fldCurrent.Name , fldCurrent.Type
strSQL = "Insert Into TableCurrent (TableName, FieldName,
FieldType) Values " & _
"('" & tdf.Name & "', '" & fldCurrent.Name & "', " &
fldCurrent.Type & ")"
dbs.Execute strSQL
Next
End If
'Exit For
Next tdf
'Debug.print

'Debug.print dbsExternal.Nam e & ":"
For Each tdf In dbsExternal.Tab leDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldExternal In tdf.Fields
'Debug.print fldExternal.Nam e, fldExternal.Typ e
strSQL = "Insert Into TableExternal (TableName, FieldName,
FieldType) Values " & _
"('" & tdf.Name & "', '" & fldExternal.Nam e & "', " &
fldExternal.Typ e & ")"
dbs.Execute strSQL
Next
End If
Next tdf
Set dbs = Nothing

dbsExternal.Clo se
Set dbsExternal = Nothing
MsgBox "Done"

End Sub

Voqa Mosimosi
http://www.youtube.com/watch?v=EQJr1LUmfLM

Jul 25 '08 #4
Phil Stanton wrote:
Thanks Salad That looks great. Will try it tonight.
Probably refine it to have all the info for all the DBs in TblCurrent with a
pointer to which DB they come from. Should be very easy to compare
Yeah, if you did a Totals query, exluding the table, if you had 5 MDBs
then you should have a count of 5 for everything. Anything not 5 would
be an exception.
Any thoughts on the relationship part of my question?
I missed that one. Here's some code from OnLine help.

Set dbsNorthwind = OpenDatabase("N orthwind.mdb")
Set rstProducts = dbsNorthwind.Op enRecordset("Pr oducts")
' Print a report showing all the different parts of
' the relation and where each part is stored.
With dbsNorthwind.Re lations!Categor iesProducts
Debug.Print "Properties of " & .Name & " Relation"
Debug.Print " Table = " & .Table
Debug.Print " ForeignTable = " & .ForeignTable
Debug.Print "Fields of " & .Name & " Relation"
With .Fields!Categor yID
Debug.Print " " & .Name
Debug.Print " Name = " & .Name
Debug.Print " ForeignName = " & .ForeignName
End With
End With
I think by modifying the code above you could add it to my routine and
insert the data into, most likely, a new table.
>
Thanks again

Phil
"Salad" <oi*@vinegar.co mwrote in message
news:nI******** *************** *******@earthli nk.com...
>>Phil Stanton wrote:
>>>I have 1 FE database which can be linked to a number of BE databases. The
BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge Club,
Family etc.

Problem is if I change anything in the table structure or relationship of
one of these clubs, I want to make sure I do it with the other clubs as
well.
Has anyone got routine that will check that each BE database has
1) All the tables (even though some will be empty e.g. Bridge club
has nothing to do with boats)
2) The fields are all the same size, default values are the same,
Indexes are the same etc
3) Relationships are identical

I am struggling to do it manually at the moment and I know it is very
error prone

Thanks for any advise

Phil

Hi Phil. Here's a routine I made up. I created two tables; TableCurrent
and TableExternal. Three fields; TableName, FieldName, FieldType. You
could add FieldSize as well and add that in the Insert statement and
insert the Size property as well. Change the External mdb name. Then
run. After that you can create some queries to check for differences
between these two tables.

Sub CheckFieldDiffe rences()

Dim dbs As Database
Dim dbsExternal As Database
Dim wsp As Workspace
Dim tdf As TableDef
Dim fldCurrent As Field
Dim fldExternal As Field
Dim strSQL As String

Dim strExternal As String
strExternal = "C:\Test\Db1.MD B" 'CHANGE TO THE EXTERNAL FILE NAME

' Return reference to current database.
Set dbs = CurrentDb
' Return reference to default workspace.
Set wsp = DBEngine.Worksp aces(0)
' Return reference to External.mdb.
Set dbsExternal = wsp.OpenDatabas e(strExternal)

' Enumerate all TableDef objects in each database.
'Debug.print dbs.Name & ":"
For Each tdf In dbs.TableDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldCurrent In tdf.Fields
'Debug.print fldCurrent.Name , fldCurrent.Type
strSQL = "Insert Into TableCurrent (TableName, FieldName,
FieldType) Values " & _
"('" & tdf.Name & "', '" & fldCurrent.Name & "', " &
fldCurrent.Ty pe & ")"
dbs.Execute strSQL
Next
End If
'Exit For
Next tdf
'Debug.print

'Debug.print dbsExternal.Nam e & ":"
For Each tdf In dbsExternal.Tab leDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldExternal In tdf.Fields
'Debug.print fldExternal.Nam e, fldExternal.Typ e
strSQL = "Insert Into TableExternal (TableName, FieldName,
FieldType) Values " & _
"('" & tdf.Name & "', '" & fldExternal.Nam e & "', " &
fldExternal.T ype & ")"
dbs.Execute strSQL
Next
End If
Next tdf
Set dbs = Nothing

dbsExternal.Clo se
Set dbsExternal = Nothing
MsgBox "Done"

End Sub

Voqa Mosimosi
http://www.youtube.com/watch?v=EQJr1LUmfLM


Jul 25 '08 #5
Do you think Windows can find your db file noticeably faster than
Access/JET can find your records?

One db will ensure that changes are made and applied consistently across
the five clubs.
One db will ensure that more clubs can be added easily.
One db will allow for the efficient entry and storage of common data.
(Could any person be a member of more than one club?)
Of course, we could write kludges to try to maintain some sort of
uniformity across the dbs.
But should we?
When I write kludges the things I forget to program haunt me at the most
inopportune times.

"Phil Stanton" <ph**@myfamilyn ame.co.ukwrote in
news:uY******** *************** *******@posted. plusnet:
I have 1 FE database which can be linked to a number of BE databases.
The BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge
Club, Family etc.

Problem is if I change anything in the table structure or relationship
of one of these clubs, I want to make sure I do it with the other
clubs as well.
Has anyone got routine that will check that each BE database has
1) All the tables (even though some will be empty e.g. Bridge club
has nothing to do with boats)
2) The fields are all the same size, default values are the same,
Indexes are the same etc
3) Relationships are identical

I am struggling to do it manually at the moment and I know it is very
error prone

Thanks for any advise

Phil
Jul 25 '08 #6
Hi Lyle

What you say seems logical. Certainly 1 member can be a member of many clubs
( I am).
I would presumably have to add a foreign key in every table to relate to the
correct DB.

The problem with that approach is that unless security is tight, A member of
1 Club can get info on members of all the other Clubs (via the tables if
nothing else) and with the data Protection Act here in the UK it could be
awkward.

Thanks,
Phil

"lyle fairfield" <ly******@yah00 .cawrote in message
news:Xn******** *************** *@216.221.81.11 9...
Do you think Windows can find your db file noticeably faster than
Access/JET can find your records?

One db will ensure that changes are made and applied consistently across
the five clubs.
One db will ensure that more clubs can be added easily.
One db will allow for the efficient entry and storage of common data.
(Could any person be a member of more than one club?)
Of course, we could write kludges to try to maintain some sort of
uniformity across the dbs.
But should we?
When I write kludges the things I forget to program haunt me at the most
inopportune times.

"Phil Stanton" <ph**@myfamilyn ame.co.ukwrote in
news:uY******** *************** *******@posted. plusnet:
>I have 1 FE database which can be linked to a number of BE databases.
The BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge
Club, Family etc.

Problem is if I change anything in the table structure or relationship
of one of these clubs, I want to make sure I do it with the other
clubs as well.
Has anyone got routine that will check that each BE database has
1) All the tables (even though some will be empty e.g. Bridge club
has nothing to do with boats)
2) The fields are all the same size, default values are the same,
Indexes are the same etc
3) Relationships are identical

I am struggling to do it manually at the moment and I know it is very
error prone

Thanks for any advise

Phil

Jul 25 '08 #7
Hi Salad

Thanks a bunch. All works a treat. Now just a metter of going through and
putting things right

BTW some of the relationships look like this
{72CB01A8-BF0B-4CD3-9D4D-150D5A1146B1}
and others like
YearPayments ( I have a table called Year and a table called Payments)
and other like
TownNewAddress ( I have a table called Town and a table called Addres, but
no NewAddress)
must be some logic in it

Thanks again

Phil

"Salad" <oi*@vinegar.co mwrote in message
news:i-*************** *************** @earthlink.com. ..
Phil Stanton wrote:
>Thanks Salad That looks great. Will try it tonight.
Probably refine it to have all the info for all the DBs in TblCurrent
with a pointer to which DB they come from. Should be very easy to compare
Yeah, if you did a Totals query, exluding the table, if you had 5 MDBs
then you should have a count of 5 for everything. Anything not 5 would be
an exception.
>Any thoughts on the relationship part of my question?

I missed that one. Here's some code from OnLine help.

Set dbsNorthwind = OpenDatabase("N orthwind.mdb")
Set rstProducts = dbsNorthwind.Op enRecordset("Pr oducts")
' Print a report showing all the different parts of
' the relation and where each part is stored.
With dbsNorthwind.Re lations!Categor iesProducts
Debug.Print "Properties of " & .Name & " Relation"
Debug.Print " Table = " & .Table
Debug.Print " ForeignTable = " & .ForeignTable
Debug.Print "Fields of " & .Name & " Relation"
With .Fields!Categor yID
Debug.Print " " & .Name
Debug.Print " Name = " & .Name
Debug.Print " ForeignName = " & .ForeignName
End With
End With
I think by modifying the code above you could add it to my routine and
insert the data into, most likely, a new table.
>>
Thanks again

Phil
"Salad" <oi*@vinegar.co mwrote in message
news:nI******* *************** ********@earthl ink.com...
>>>Phil Stanton wrote:

I have 1 FE database which can be linked to a number of BE databases.
The BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge
Club, Family etc.

Problem is if I change anything in the table structure or relationship
of one of these clubs, I want to make sure I do it with the other clubs
as well.
Has anyone got routine that will check that each BE database has
1) All the tables (even though some will be empty e.g. Bridge club
has nothing to do with boats)
2) The fields are all the same size, default values are the same,
Indexes are the same etc
3) Relationships are identical

I am struggling to do it manually at the moment and I know it is very
error prone

Thanks for any advise

Phil

Hi Phil. Here's a routine I made up. I created two tables; TableCurrent
and TableExternal. Three fields; TableName, FieldName, FieldType. You
could add FieldSize as well and add that in the Insert statement and
insert the Size property as well. Change the External mdb name. Then
run. After that you can create some queries to check for differences
between these two tables.

Sub CheckFieldDiffe rences()

Dim dbs As Database
Dim dbsExternal As Database
Dim wsp As Workspace
Dim tdf As TableDef
Dim fldCurrent As Field
Dim fldExternal As Field
Dim strSQL As String

Dim strExternal As String
strExternal = "C:\Test\Db1.MD B" 'CHANGE TO THE EXTERNAL FILE NAME

' Return reference to current database.
Set dbs = CurrentDb
' Return reference to default workspace.
Set wsp = DBEngine.Worksp aces(0)
' Return reference to External.mdb.
Set dbsExternal = wsp.OpenDatabas e(strExternal)

' Enumerate all TableDef objects in each database.
'Debug.print dbs.Name & ":"
For Each tdf In dbs.TableDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldCurrent In tdf.Fields
'Debug.print fldCurrent.Name , fldCurrent.Type
strSQL = "Insert Into TableCurrent (TableName, FieldName,
FieldType) Values " & _
"('" & tdf.Name & "', '" & fldCurrent.Name & "', " &
fldCurrent.Ty pe & ")"
dbs.Execute strSQL
Next
End If
'Exit For
Next tdf
'Debug.print

'Debug.print dbsExternal.Nam e & ":"
For Each tdf In dbsExternal.Tab leDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldExternal In tdf.Fields
'Debug.print fldExternal.Nam e, fldExternal.Typ e
strSQL = "Insert Into TableExternal (TableName,
FieldName, FieldType) Values " & _
"('" & tdf.Name & "', '" & fldExternal.Nam e & "', " &
fldExternal.T ype & ")"
dbs.Execute strSQL
Next
End If
Next tdf
Set dbs = Nothing

dbsExternal.Clo se
Set dbsExternal = Nothing
MsgBox "Done"

End Sub

Voqa Mosimosi
http://www.youtube.com/watch?v=EQJr1LUmfLM

Jul 26 '08 #8
On Jul 25, 1:10 pm, "Phil Stanton" <p...@myfamilyn ame.co.ukwrote:
Hi Lyle

What you say seems logical. Certainly 1 member can be a member of many clubs
( I am).
I would presumably have to add a foreign key in every table to relate to the
correct DB.

The problem with that approach is that unless security is tight, A member of
1 Club can get info on members of all the other Clubs (via the tables if
nothing else) and with the data Protection Act here in the UK it could be
awkward.

Thanks,
Phil

"lyle fairfield" <lylef...@yah00 .cawrote in message

news:Xn******** *************** *@216.221.81.11 9...
Do you think Windows can find your db file noticeably faster than
Access/JET can find your records?
One db will ensure that changes are made and applied consistently across
the five clubs.
One db will ensure that more clubs can be added easily.
One db will allow for the efficient entry and storage of common data.
(Could any person be a member of more than one club?)
Of course, we could write kludges to try to maintain some sort of
uniformity across the dbs.
But should we?
When I write kludges the things I forget to program haunt me at the most
inopportune times.
"Phil Stanton" <p...@myfamilyn ame.co.ukwrote in
news:uY******** *************** *******@posted. plusnet:
I have 1 FE database which can be linked to a number of BE databases.
The BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge
Club, Family etc.
Problem is if I change anything in the table structure or relationship
of one of these clubs, I want to make sure I do it with the other
clubs as well.
Has anyone got routine that will check that each BE database has
1) All the tables (even though some will be empty e.g. Bridge club
has nothing to do with boats)
2) The fields are all the same size, default values are the same,
Indexes are the same etc
3) Relationships are identical
I am struggling to do it manually at the moment and I know it is very
error prone
Thanks for any advise
Phil
I think I understand now that you do not use these five dbs on one
computer, but, rather, distribute one or the other to a club
administrator.
Jul 26 '08 #9
Phil Stanton wrote:
Hi Salad

Thanks a bunch. All works a treat. Now just a metter of going through and
putting things right

BTW some of the relationships look like this
{72CB01A8-BF0B-4CD3-9D4D-150D5A1146B1}
and others like
YearPayments ( I have a table called Year and a table called Payments)
and other like
TownNewAddress ( I have a table called Town and a table called Addres, but
no NewAddress)
must be some logic in it

Thanks again
Glad it all worked out! As to the odd names...sounds like they're
Access generated.
>
Phil

"Salad" <oi*@vinegar.co mwrote in message
news:i-*************** *************** @earthlink.com. ..
>>Phil Stanton wrote:

>>>Thanks Salad That looks great. Will try it tonight.
Probably refine it to have all the info for all the DBs in TblCurrent
with a pointer to which DB they come from. Should be very easy to compare

Yeah, if you did a Totals query, exluding the table, if you had 5 MDBs
then you should have a count of 5 for everything. Anything not 5 would be
an exception.

>>>Any thoughts on the relationship part of my question?

I missed that one. Here's some code from OnLine help.

Set dbsNorthwind = OpenDatabase("N orthwind.mdb")
Set rstProducts = dbsNorthwind.Op enRecordset("Pr oducts")
' Print a report showing all the different parts of
' the relation and where each part is stored.
With dbsNorthwind.Re lations!Categor iesProducts
Debug.Print "Properties of " & .Name & " Relation"
Debug.Print " Table = " & .Table
Debug.Print " ForeignTable = " & .ForeignTable
Debug.Print "Fields of " & .Name & " Relation"
With .Fields!Categor yID
Debug.Print " " & .Name
Debug.Print " Name = " & .Name
Debug.Print " ForeignName = " & .ForeignName
End With
End With
I think by modifying the code above you could add it to my routine and
insert the data into, most likely, a new table.

>>>Thanks again

Phil
"Salad" <oi*@vinegar.co mwrote in message
news:nI***** *************** **********@eart hlink.com...
Phil Stanton wrote:
>I have 1 FE database which can be linked to a number of BE databases.
>The BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge
>Club, Family etc.
>
>Problem is if I change anything in the table structure or relationship
>of one of these clubs, I want to make sure I do it with the other clubs
>as well.
>Has anyone got routine that will check that each BE database has
>1) All the tables (even though some will be empty e.g. Bridge club
>has nothing to do with boats)
>2) The fields are all the same size, default values are the same,
>Indexes are the same etc
>3) Relationships are identical
>
>I am struggling to do it manually at the moment and I know it is very
>error prone
>
>Thanks for any advise
>
>Phil

Hi Phil. Here's a routine I made up. I created two tables; TableCurrent
and TableExternal. Three fields; TableName, FieldName, FieldType. You
could add FieldSize as well and add that in the Insert statement and
insert the Size property as well. Change the External mdb name. Then
run. After that you can create some queries to check for differences
between these two tables.

Sub CheckFieldDiffe rences()

Dim dbs As Database
Dim dbsExternal As Database
Dim wsp As Workspace
Dim tdf As TableDef
Dim fldCurrent As Field
Dim fldExternal As Field
Dim strSQL As String

Dim strExternal As String
strExternal = "C:\Test\Db1.MD B" 'CHANGE TO THE EXTERNAL FILE NAME

' Return reference to current database.
Set dbs = CurrentDb
' Return reference to default workspace.
Set wsp = DBEngine.Worksp aces(0)
' Return reference to External.mdb.
Set dbsExternal = wsp.OpenDatabas e(strExternal)

' Enumerate all TableDef objects in each database.
'Debug.print dbs.Name & ":"
For Each tdf In dbs.TableDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldCurrent In tdf.Fields
'Debug.print fldCurrent.Name , fldCurrent.Type
strSQL = "Insert Into TableCurrent (TableName, FieldName,
FieldType ) Values " & _
"('" & tdf.Name & "', '" & fldCurrent.Name & "', " &
fldCurrent. Type & ")"
dbs.Execute strSQL
Next
End If
'Exit For
Next tdf
'Debug.print

'Debug.print dbsExternal.Nam e & ":"
For Each tdf In dbsExternal.Tab leDefs
'Debug.print tdf.Name
If Left(tdf.Name, 3) <"tmp" Then
For Each fldExternal In tdf.Fields
'Debug.print fldExternal.Nam e, fldExternal.Typ e
strSQL = "Insert Into TableExternal (TableName,
FieldName , FieldType) Values " & _
"('" & tdf.Name & "', '" & fldExternal.Nam e & "', " &
fldExternal .Type & ")"
dbs.Execute strSQL
Next
End If
Next tdf
Set dbs = Nothing

dbsExternal.Clo se
Set dbsExternal = Nothing
MsgBox "Done"

End Sub

Voqa Mosimosi
http://www.youtube.com/watch?v=EQJr1LUmfLM

Jul 26 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2052
by: Minh Tran | last post by:
In order to minimize the number of connection strings I have to use to access different databases on the same Sql Server, I was considering storing all stored procedures in just one database. I want to do this because connection pooling in my application - ASP.NET is based on this connection string. So if I need to access 6 different databases on one sql server & set 6 different connection strings, I end up creating 6 different...
1
439
by: Avanish Pandey | last post by:
Hello All We have 3 differen services (in 3 different server) Service A,B,C . We want to implement distributed transaction when call methods of B and C from A. Is it possible? if yes then how? I have read the doc regarding this: http://www.developer.com/net/asp/article.php/3385631 but it will not work when methods are in different services on
10
1916
by: Steven T. Hatton | last post by:
I've mentioned a few times that the lack of standard filenames in C++ can be problematic. This is an example of the kind of situation where it becomes so. I tend to switch between using Emacs and KDevelop. I often find Emacs easier to use for simple test code, but KDevelop (when the cvs image is healthy) tends to facilitate better overal project organization. Not infrequently, I want to work on code written with one tool in the other....
0
1723
by: xixi | last post by:
we are using db2 udb v8.1 on win 64 bit HP titanium machine with fp3 with type 4 db2jcc.jar driver. i have two database created under different patition on same drive. when i do db2dart on the database, i found both database have the same index bad page error on same table. one database is the same image of another except the tablespace redirect to different patition. the index should be created under the same tablespace relates to its...
20
17642
by: xixi | last post by:
hi, we use db2 udb v8.1 on windows, i am trying to use federated database objects to create wrapper, even though i have update dbm cfg using federated yes, i still get error "the instance for the db is not enable for the specified action", do i miss sth else?
5
2071
by: Rich | last post by:
Hi there, For a quite big application, I need to get large amount of data within a static library (xxx.lib) and put them in a database (a class, say we call it CData), and then make it accessible by a few different dynamic library files (yyy.dll, …). I’ve tried to create a global class object of CData*, say pData, by declaring it as an external in the header and initiate it in the cpp of a dll file. But it doesn’t work. Other dlls...
5
1297
by: Mr Newbie | last post by:
Now I know that VS2005 has master pages and web parts etc etc. However, at present I am forced to work with VS2003 so I have a couple of basic questions related to the subject matter for which I am hoping to achieve inspirational and or direction. Having learnt a reasonable amount of the basic's on ASP.NET, I know want to try and design and build a fully working commercial site I want to create my new site with a degree of visual...
2
1451
by: cygsoft | last post by:
Hi I have designed some Web Pages using Dreamweaver. The screens are looking fine when previewed with IE 6 browser. But when I view those in Netscape, the screens are totally collapsed. So can anyone help me how to design webpages to provide uniformity in browsers.
3
6432
by: krzys | last post by:
I have 2 databases (with different user names and different passwords), and I need to join column_1 from table_A (on first database: database_I) on column_2 from table_B (on second database: database_II). How query should likes? I want to do this in php - where should I specify different user names and diffrent passwords for databases? <?php $dbhost="server_name\instance_name,port_number";
0
9588
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10589
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.