473,763 Members | 7,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DAO - which properties apply to each field type?

Hello everyone,

I am working on an application that can build database objects in MS
Access from text files. I suppose you could call it a backup and
restore type routine.

Accessing the fields, tables, relationships, and indexes is no issue
for me via DAO code. The issue I have is that I am not sure which
properties are actually necessary / available to set from code for each
possible type of field. I have looked fo´r a reference on this, but
cannot find one for specifically this task.

What I am looking for is a simple "grid" even, that would have Jet
Field Properties along one side of the grid, and along the other the
field types (eg dbBoolean, dbInteger, etc...), and marking off which
ones apply to which field type.

Does anyone have this type of information or where I can get it? It
would save me many hours of playing around.

Cheers and Thanks

The Frog.

Dec 6 '06 #1
17 4029
On 6 Dec 2006 06:46:37 -0800, "The Frog" <an************ **@eu.effem.com wrote:
>Hello everyone,

I am working on an application that can build database objects in MS
Access from text files. I suppose you could call it a backup and
restore type routine.

Accessing the fields, tables, relationships, and indexes is no issue
for me via DAO code. The issue I have is that I am not sure which
properties are actually necessary / available to set from code for each
possible type of field. I have looked fo´r a reference on this, but
cannot find one for specifically this task.

What I am looking for is a simple "grid" even, that would have Jet
Field Properties along one side of the grid, and along the other the
field types (eg dbBoolean, dbInteger, etc...), and marking off which
ones apply to which field type.

Does anyone have this type of information or where I can get it? It
would save me many hours of playing around.

Cheers and Thanks

The Frog.
You can save many more hours of playing around by going to -

http://www.ffdba.com/downloads/Save_...ts_As_Text.htm
Wayne Gillespie
Gosford NSW Australia
Dec 6 '06 #2
Hi Wayne,

Appreciate the idea, but the link doesnt work. Did you type the link
correctly?

I have several of these types of utilities, but mostly they ignore the
field properties. I need to capture the field properties to do this for
our application. We have a large number of dependencies built on this
application, and I need to be absolutely certain that I have exactly
everything that is needed, no guesswork or possible oversights.

Any chance you might be able to re-post / check the link you provided?

Dec 6 '06 #3
"The Frog" <an************ **@eu.effem.com wrote in
news:11******** **************@ l12g2000cwl.goo glegroups.com:
Hi Wayne,

Appreciate the idea, but the link doesn’t work. Did you type the link
correctly?
The link (http://www.ffdba.com/downloads/Get_Object_Names.htm) works but
this does not do what you want. [Thanks, Wayne for mentioning it.]

You mentioned backup; I think you want documentation.
While the utility mentioned creates text manifestations of all Access and
VBA objects it does not do so with JET objects, which are simply backed-
up.

If I were doing something such as (I think) you want to do I would use
ADO. I realize that those unfamiliar with ADO say that it will do nothing
that DAO won't do and I agree that after the first few hundred advantages
it's difficult to find more; but this is one of the first few hundred.

If you go to
http://www.ffdba.com/columns.asp

and click All and then Submit you will get an idea of the kind of
information that ADO can provide simply and quickly about Tables. (This
is a dynamic page; that is it gets the information anew each time it is
loaded).

If you go to
http://www.ffdba.com/procedures.asp

you will see how ADO can list all queries (sprocs), views etc.

The pages you will see (if you can click twice on the links, that is,)
are created with ASP/Javascript and ADO and reference an MS-SQL database.
But all the procedures are entirely doable with Access, VBA and a JET
Database. Of course, instead of presenting the information as an HTML
page, one is likely to save it to a file.

http://www.ffdba.com/downloads/Get_Object_Names.htm is not a complete
solution for this but it may give you a start.

Just the idea of looping through DAO definitions to do this is painful to
me. ADO will give you the information you need instantly and painlessly.

--
Lyle Fairfield

from http://msdn.microsoft.com/library/de...l=/library/en-
us/dnmdac/html/data_mdacroadma p.asp

Obsolete Data Access Technologies
Obsolete technologies are technologies that have not been enhanced or
updated in several product releases and that will be excluded from future
product releases. Do not use these technologies when you write new
applications. When you modify existing applications that are written
using these technologies, consider migrating those applications to
ADO.NET.
The following components are considered obsolete:
....
Data Access Objects (DAO): DAO provides access to JET (Access) databases.
This API can be used from Microsoft Visual Basic®, Microsoft Visual C++®,
and scripting languages. It was included with Microsoft Office 2000 and
Office XP. DAO 3.6 is the final version of this technology. It will not
be available on the 64-bit Windows operating system.
.....
Dec 6 '06 #4
Thanks once again Lyle,

I originally would have approached the situation from an ADO / ADOX
point of view, bet there remains one problem with this, or at least not
one I know how to solve:

- There are a number of "user defined" properties (UDP's) that are
ascribed to the fields and tables in the source database. Inside these
UDP's are stored (cryptographica lly) some cryptographic keys, which
allow a user (if they have a key) to access the data in the field or
table as the case may be. This works a bit similarly to how EFS works
for files in Win 2K or newer. There is a UDP based on the users
identifier for the application, and it is appended as a property to the
table or field. This then has a value set which corresponds to the
cryptographical ly stored value of the key which is in turn used to
decrypt the data stored in either a table or field. This is used
becuase of the level of granularity it gives, and is much less
susceptable to attacks on workgroup files etc... It also makes the
database much more portable in the sense of application deployment as
you really need nothing special.

The need for the DAO code is to actually allow the transfer of
structures (meta-data) between the various remote users of the
application and the "server" which holds the definitive copy of the
information. So, for example, if a new table is built, and only
intended for some users, then that table structure and the defined
UDP's need to be sent, via a text method, to the remote users.

The catch is two fold:
1/ We may not know which users are allowed which tables / fields, and
in fact this may change from time to time even for existing structures
- therefore we dont the the property name of the UDP.
2/ The cryptography algorythm uses the other other properties
associated with the table / field as part of its authentication
process, however I am told that it doesnt depend on fields that cannot
be set programatically - due to the need to occasionally change keys
etc.

I am not sure how to approach this from an ADOX perspective and
guarantee that all the properties have been correctly read, copied (to
text), and then are able to be set again in a destination (target)
database. I am aware that this is entirely possible with DAO. If,
however, there is an ADOX method of doing exactly the same thing, then
I am all ears. As of writing this I am of the belief (researched but
willing to change) that this is not actually possible at this level of
granularity with ADOX.

Can it be confirmed that the properties collection of a field / table
etc in ADOX exactly matches the properties collection (in terms of
information content and programability) of field / table in DAO for a
Jet database?

I have been unable to find a confirmation of this, or a similar
"reference" stating each property that can be set / programmed for each
field type. Do you have anything that may reference this issue
definitivley?

The Frog

Dec 8 '06 #5
The Frog wrote:
Thanks once again Lyle,

I originally would have approached the situation from an ADO / ADOX
point of view, bet there remains one problem with this, or at least not
one I know how to solve:

- There are a number of "user defined" properties (UDP's) that are
ascribed to the fields and tables in the source database. Inside these
UDP's are stored (cryptographica lly) some cryptographic keys, which
allow a user (if they have a key) to access the data in the field or
table as the case may be. This works a bit similarly to how EFS works
for files in Win 2K or newer. There is a UDP based on the users
identifier for the application, and it is appended as a property to the
table or field. This then has a value set which corresponds to the
cryptographical ly stored value of the key which is in turn used to
decrypt the data stored in either a table or field. This is used
becuase of the level of granularity it gives, and is much less
susceptable to attacks on workgroup files etc... It also makes the
database much more portable in the sense of application deployment as
you really need nothing special.

The need for the DAO code is to actually allow the transfer of
structures (meta-data) between the various remote users of the
application and the "server" which holds the definitive copy of the
information. So, for example, if a new table is built, and only
intended for some users, then that table structure and the defined
UDP's need to be sent, via a text method, to the remote users.

The catch is two fold:
1/ We may not know which users are allowed which tables / fields, and
in fact this may change from time to time even for existing structures
- therefore we dont the the property name of the UDP.
2/ The cryptography algorythm uses the other other properties
associated with the table / field as part of its authentication
process, however I am told that it doesnt depend on fields that cannot
be set programatically - due to the need to occasionally change keys
etc.

I am not sure how to approach this from an ADOX perspective and
guarantee that all the properties have been correctly read, copied (to
text), and then are able to be set again in a destination (target)
database. I am aware that this is entirely possible with DAO. If,
however, there is an ADOX method of doing exactly the same thing, then
I am all ears. As of writing this I am of the belief (researched but
willing to change) that this is not actually possible at this level of
granularity with ADOX.

Can it be confirmed that the properties collection of a field / table
etc in ADOX exactly matches the properties collection (in terms of
information content and programability) of field / table in DAO for a
Jet database?

I have been unable to find a confirmation of this, or a similar
"reference" stating each property that can be set / programmed for each
field type. Do you have anything that may reference this issue
definitivley?

The Frog
I believe that ADO and ADOX can find all Access properties of tables

DatasheetBackCo lor, DatasheetCellsE ffect, DatasheetFontHe ight,
DatasheetFontIt alic, DatasheetFontNa me, DatasheetFontUn derline,
DatasheetFontWe ight, DatasheetForeCo lor, DatasheetGridli nesBehavior,
DatasheetGridli nesColor, Description, FrozenColumns, RowHeight,
ShowGrid

but I don't know of a way for either to find (DAO) UDPs.

Dec 8 '06 #6
I have done some further research based on what we have been
discussing, and the ADOX cannot actually reach this data (met data) it
seems, as it is a purely specific JET / DAO thing. It appears that ADOX
is unable to create properties that otherwise do not already exist.
This seems a little odd to me, but then again that JET for you.

There is also a problem working with ADO when using Access 97 (GOD help
me we are still using it as a corporate standard), and that is ADO was
released after the fact so to speak, and as such you are unable to
create a connection easily directly inside the application you are
working from like you can in DAO. (eg in DAO you have the currentdb()
function for database objects, but in Access97 the ADO "currentproject "
type of approach simply doesnt work as its just not there and you end
up with an error, strange database locks for workarounds, etc...)

Unfortunately it looks like this is a pure DAO based job, and I am just
going to have to play with the fields and figure out the properties
that can and cannot be set for each field type, and then try to
reproduce the necessary parts in the target database.

When I eventually finish the code for this ***expletive deleted*** task
I will post it here so that if anyone else needs it they can have the
benefit of my pain and lost weekend......

Thanks for trying to help with this, it is appreciated. Unfortunately
it is a bit more complex than originally anticipated so it may take a
bit to get it right.

Thanks for your help

Cheers

The Frog

Dec 8 '06 #7
The Frog wrote:
I have done some further research based on what we have been
discussing, and the ADOX cannot actually reach this data (met data) it
seems, as it is a purely specific JET / DAO thing. It appears that ADOX
is unable to create properties that otherwise do not already exist.
This seems a little odd to me, but then again that JET for you.

There is also a problem working with ADO when using Access 97 (GOD help
me we are still using it as a corporate standard), and that is ADO was
released after the fact so to speak, and as such you are unable to
create a connection easily directly inside the application you are
working from like you can in DAO. (eg in DAO you have the currentdb()
function for database objects, but in Access97 the ADO "currentproject "
type of approach simply doesnt work as its just not there and you end
up with an error, strange database locks for workarounds, etc...)

Unfortunately it looks like this is a pure DAO based job, and I am just
going to have to play with the fields and figure out the properties
that can and cannot be set for each field type, and then try to
reproduce the necessary parts in the target database.

When I eventually finish the code for this ***expletive deleted*** task
I will post it here so that if anyone else needs it they can have the
benefit of my pain and lost weekend......

Thanks for trying to help with this, it is appreciated. Unfortunately
it is a bit more complex than originally anticipated so it may take a
bit to get it right.

Thanks for your help

Cheers

The Frog
Good Luck! ADO with the old is not so great. When I first tried ADO in
Access many years ago it made a hard disk direct write every time data
was saved, and I mean direct; there was an audible click form the hard
drive and then some whirring and a pause of several seconds.

Dec 8 '06 #8
Hi Lyle,

Got the bulk of the hard work done. I have managed to figure out all
the DAO required code for handling the table structures, indexes,
fields, and relationships, but now I am stuck on something that doesnt
seem to make any sense. I cant return the data in the function I wrote
due to a Type Mismatch issue.

I used a User defined data type to handle the information inside the
function. This seemed the easiest way to collect all the necessary data
and house it in the right format and structure. The function creates an
array of the user defined data type, populates it as it goes, and then
it is supposed to return that array to the calling procedure. BUT, it
wont return the data. I cant figure out why - I have done this many
times before, but maybe I am just missing something really obvious.

Would you mind having a quick look to see what I have missed. The DAO
code works fine, I just cant seem to return the info!

The code is below: (I placed it in a new standard module in Access 97)

Private Type ObjectPropertie s
TFIR As String
ID As Integer
Name As String
PropertyName As String
PropertyType As Integer
PropertyValue As Variant
End Type

Function TableStructures () As ObjectPropertie s

Dim db As DAO.Database
Dim td As DAO.TableDef
Dim pp As DAO.Property
Dim fd As DAO.Field
Dim ix As DAO.Index
Dim rl As DAO.Relation

Dim Count As Integer
Dim ID As Integer
Dim DataArray() As ObjectPropertie s

Set db = CurrentDb
Count = 0
ID = 0

For Each td In db.TableDefs
ID = ID + 1
Select Case td.Name
Case ("MSysACEs")
Case ("MSysModule s")
Case ("MSysModules2" )
Case ("MSysObject s")
Case ("MSysQuerie s")
Case ("MSysRelations hips")
Case Else
'first step is to grab the relevant table properties and
'discard the rubbish ones. Also need to pick up the user
'and application defined properties and save them too
For Each pp In td.Properties
Select Case pp.Name
Case ("ConflictTable ")
Case ("DateCreate d")
Case ("LastUpdate d")
Case ("RecordCoun t")
Case ("ReplicaFilter ")
Case Else
ReDim Preserve DataArray(Count )
DataArray(Count ).ID = ID
DataArray(Count ).Name = td.Name
DataArray(Count ).PropertyName = pp.Name
DataArray(Count ).PropertyType = pp.Type
DataArray(Count ).PropertyValue = pp.Value
DataArray(Count ).TFIR = "T"
Count = Count + 1
End Select
Next
'now it is necessary to get the field definitions for this
table
'and store the relevant properties, discard the rubbish and
'collect also the application and user defined properties
For Each fd In td.Fields
For Each pp In fd.Properties
Select Case pp.Name
Case ("DataUpdatable ")
Case ("FieldSize" )
Case ("ForeignNam e")
Case ("OriginalValue ")
Case ("SourceFiel d")
Case ("SourceTabl e")
Case ("ValidateOnSet ")
Case ("Value")
Case ("VisibleValue" )
Case Else
ReDim Preserve DataArray(Count )
DataArray(Count ).ID = ID
DataArray(Count ).Name = fd.Name
DataArray(Count ).PropertyName = pp.Name
DataArray(Count ).PropertyType = pp.Type
DataArray(Count ).PropertyValue = pp.Value
DataArray(Count ).TFIR = "F"
Count = Count + 1
End Select 'this is the end select on the field
properties
Next 'this cycles to the next field property
Next 'this cycles to the next field
'grab the indexes for the table here and store them in the
DataArray
'first get the index and its properties
'then get the fields for the index itself
For Each ix In td.Indexes
Select Case ix.Foreign 'need to do foreign indexes via
relations
Case ("True")
Case Else
If Left(ix.Name, 1) <"{" Then 'ignore the
GUID indexes
For Each pp In ix.Properties
Select Case pp.Name
Case ("DistinctCount ")
Case Else
ReDim Preserve DataArray(Count )
DataArray(Count ).ID = ID
DataArray(Count ).Name = ix.Name
DataArray(Count ).PropertyName =
pp.Name
DataArray(Count ).PropertyType =
pp.Type
DataArray(Count ).PropertyValue
= pp.Value
DataArray(Count ).TFIR = "I"
Count = Count + 1
End Select
Next
'now grab the fields in the index itself
For Each fd In ix.Fields
ReDim Preserve DataArray(Count )
DataArray(Count ).ID = ID
DataArray(Count ).Name = ix.Name
DataArray(Count ).PropertyName = fd.Name
'DataArray(Coun t).PropertyType =
fd.Type
'DataArray(Coun t).PropertyValu e =
fd.Value
DataArray(Count ).TFIR = "IF"
Count = Count + 1
Next 'cycles the fields
End If 'end of the if for the index type
selection
End Select 'end of the selection of foreign key index
or not
Next 'this cycles through the indexes themselves
End Select 'this is the end select on the tabledefs themselves
Next 'this cycles to the next tabledef

'all the tables and fields and indexes are now complete, time to grab
the relations between tables
'note that the ID variable and the Count variable are still operating

For Each rl In db.Relations
ID = ID + 1
For Each pp In rl.Properties
ReDim Preserve DataArray(Count )
DataArray(Count ).ID = ID
DataArray(Count ).Name = rl.Name
DataArray(Count ).PropertyName = pp.Name
DataArray(Count ).PropertyType = pp.Type
DataArray(Count ).PropertyValue = pp.Value
DataArray(Count ).TFIR = "R"
Count = Count + 1
Next
For Each fd In rl.Fields
ReDim Preserve DataArray(Count )
DataArray(Count ).ID = ID
DataArray(Count ).Name = fd.Name
DataArray(Count ).TFIR = "F"
Count = Count + 1
For Each pp In fd.Properties
Select Case pp.Name
Case ("ForeignNam e")
ReDim Preserve DataArray(Count )
DataArray(Count ).ID = ID
DataArray(Count ).Name = fd.Name
DataArray(Count ).PropertyName = pp.Name
DataArray(Count ).PropertyType = pp.Type
DataArray(Count ).PropertyValue = pp.Value
DataArray(Count ).TFIR = "RFP"
Count = Count + 1
End Select
Next
Next
Next

TableStructures = DataArray

End Function

Dec 14 '06 #9
The Frog wrote:
Hi Lyle,
Private Type ObjectPropertie s
TFIR As String
ID As Integer
Name As String
PropertyName As String
PropertyType As Integer
PropertyValue As Variant
End Type

Function TableStructures () As ObjectPropertie s
Dim DataArray() As ObjectPropertie s
TableStructures = DataArray
My guess:
DataArray is an Array of ObjectPropertie s;
TablesStructure s is an Instance of (one) ObjectPropertie s

So one cannot be assigned to the other as they are different types.

My suggestion:
Dim DataArray() As Variant

Dec 14 '06 #10

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

Similar topics

3
1739
by: Mike Partridge | last post by:
Is it possible to access your caller's (not parent) context while inside a <xsl:template match...> or <xsl:for-each...>? Here is the xml I'm using: <report-set> ...<report> .....<detail-data> .......<detail-column position="1" dsc="col1" sum_fg="0"/> .......<detail-column position="2" dsc="col2" sum_fg="1"/> .......<detail-column position="3" dsc="col3" sum_fg="1"/>
0
2957
by: Pato Secruza | last post by:
Hi everyone! I have a really frustrating error and need help. I’m trying to do a function that gets the properties and names of the fields in a MS Access database using ASP. I haven’t programmed in a while so I’m quite lost. Once I have the my database structure I will insert the corresponding fields from a web form but the database is huge and I want to be able to change the database and form without changing the ASP code all the
8
3362
by: deko | last post by:
I'm hoping someone can sanity check my understanding of the Object Model for Forms/Controls. I'm having trouble drilling down into Control properties. First, I have a record set with the following for a given Form: 1)Container
3
3182
by: Larry | last post by:
In Access each field has individual properties (font, size, color etc). Is there a way around having to enter all these similar properties for each field. This seems so redundant. Is there a way that I can set up these properties only once and have individual fields use these settings?
18
18417
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
7
8531
by: Donald Grove | last post by:
Is it possible to retrieve field properties from a table in access2000 using code? I have tried: " dim dbs as dao.database dim tbl as dao.tabledef dim fld as dao.field dim prop as dao.property
0
1006
by: jwtulp | last post by:
Hello, I have a question about XmlSerialization. I have a class with a private field called createDate of the type DateTime. In the constructor of my class I use DateTime. Now to create a timestamp that is assigned to the field createDate. Because I want to encapsulate as much as possible of my class data and don't want clients of my class to change the createDate but only read it, I encapsulate the createDate field with a get Property....
47
467
by: Jon Slaughter | last post by:
private string name; public string Name { get { return name; } set { name = value; } } In the above, why doesn't C# just allow one to create a single directive to make a property?
26
1780
by: optimistx | last post by:
A variable in global scope var a1 = 'contents of global variable a1'; can be references (with some limitations) as window; // or window.a1; // or even window;
0
9387
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
10148
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...
0
9823
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
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
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
5270
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
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
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

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.