473,770 Members | 4,029 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
17 4031
Hi Lyle,

Found out what the issue is: you cant return an array of user defined
data type, you can only return a single UDT from a function.

Bummer. I think what I will do is simply convert this to an array of
strings, have them comma or tab delimited, and return the array of
strings as a variant from the function. UDT's werent so useful here as
I would have hoped.

New code to come....

Cheers

The Frog

Dec 15 '06 #11
And the answer is....(drumroll please....) : [and the crowd
goes wild]

Function TableStructures () As Variant

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 output() As String

Set db = CurrentDb
Count = 0
ID = 0

ReDim Preserve output(Count)
output(Count) = "ID,Name,Proper tyName,Property Type,PropertyVa lue,TFIR"
Count = Count + 1

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 output(Count)
output(Count) = ID
output(Count) = output(Count) & "," & td.Name
output(Count) = output(Count) & "," & pp.Name
output(Count) = output(Count) & "," & pp.Type
output(Count) = output(Count) & "," & pp.Value
output(Count) = output(Count) & "," & "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 output(Count)
output(Count) = ID
output(Count) = output(Count) & "," &
fd.Name
output(Count) = output(Count) & "," &
pp.Name
output(Count) = output(Count) & "," &
pp.Type
output(Count) = output(Count) & "," &
pp.Value
output(Count) = output(Count) & "," & "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 output(Count)
output(Count) = ID
output(Count) = output(Count) &
"," & ix.Name
output(Count) = output(Count) &
"," & pp.Name
output(Count) = output(Count) &
"," & pp.Type
output(Count) = output(Count) &
"," & pp.Value
output(Count) = output(Count) &
"," & "I"
Count = Count + 1
End Select
Next
'now grab the fields in the index itself
For Each fd In ix.Fields
ReDim Preserve output(Count)
output(Count) = ID
output(Count) = output(Count) & "," &
ix.Name
output(Count) = output(Count) & "," &
fd.Name
output(Count) = output(Count) & ","
output(Count) = output(Count) & ","
output(Count) = output(Count) & "," &
"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 output(Count)
output(Count) = ID
output(Count) = output(Count) & "," & rl.Name
output(Count) = output(Count) & "," & pp.Name
output(Count) = output(Count) & "," & pp.Type
output(Count) = output(Count) & "," & pp.Value
output(Count) = output(Count) & "," & "R"
Count = Count + 1
Next
For Each fd In rl.Fields
ReDim Preserve output(Count)
output(Count) = ID
output(Count) = output(Count) & "," & fd.Name
output(Count) = output(Count) & ","
output(Count) = output(Count) & ","
output(Count) = output(Count) & ","
output(Count) = output(Count) & "," & "F"
Count = Count + 1
For Each pp In fd.Properties
Select Case pp.Name
Case ("ForeignNam e")
ReDim Preserve output(Count)
output(Count) = ID
output(Count) = output(Count) & "," & fd.Name
output(Count) = output(Count) & "," & pp.Name
output(Count) = output(Count) & "," & pp.Type
output(Count) = output(Count) & "," & pp.Value
output(Count) = output(Count) & "," & "RFP"
Count = Count + 1
End Select
Next
Next
Next

TableStructures = output
End Function

now to do the other half of the problem, and make the code to read all
this and "rebuild" a database and all its bits..... ah well, a brief
moment of victory is better than no victory at all...
I will post the rebuild routine here as well. It may take me a day or
two to write it and make it actually work, but in the end we should end
up with two functions, one to grab a structural definition of the
tables and all associated objects, and the other to build them from the
definition.

Its actually pretty cool when you think that you could just send
someone a simple text email with a complete database structure and know
that they can build it in a matter of seconds at the other end. Cant
wait to show my boss this when it is done. I think I will do it with a
full database definition though, and cheat a little by using the
application.sav eastext and application.loa dfromtext functions for the
rest of the objects. I just cant be stuffed playing with DAO anymore.

Are you aware o´f any issues regarding the application.sav easstext and
application.loa dfromtext functions? I know that strictly speaking they
are not supported, but still, if they work...

Cheers

The Frog

Dec 15 '06 #12
"The Frog" <an************ **@eu.effem.com wrote in
news:11******** **************@ 73g2000cwn.goog legroups.com:
And the answer is....(drumroll please....) : [and the crowd
Its actually pretty cool when you think that you could just send
someone a simple text email with a complete database structure and know
that they can build it in a matter of seconds at the other end. Cant
wait to show my boss this when it is done. I think I will do it with a
full database definition though, and cheat a little by using the
application.sav eastext and application.loa dfromtext functions for the
rest of the objects. I just cant be stuffed playing with DAO anymore.

Are you aware o´f any issues regarding the application.sav easstext and
application.loa dfromtext functions? I know that strictly speaking they
are not supported, but still, if they work...

Cheers

The Frog
They have always worked flawlessy for me. Your work will add the missing
features, viz, the JET parts as text.

I suppose next you will write a utility that creates an Access database
from text and enables the user to create that text? Perhaps you could call
it "In the Beginning was the Word"?

--
Lyle Fairfield
Dec 15 '06 #13
The thought had crossed my mind! A real genesis script for the Jet
engine. Its kind of what I am working on, but for a slightly different
purpose.

The goal of all of this is actually quite simple. What I am trying to
create is an access application that can run via the RunTime version,
and is able to be updated remotely with new structural information and
data.

By separating the structural from the data, particularly with the
tabledefs (oops...I still need to do the DB properties!), I am able to
add some very granular security and also minimise the data sent between
the host (probably me having to maintain it), and the remote users.
With some simple version control, and some VBA code to get everything
in check when the client application starts up, I can basically deploy
any data structure, to anybody, via simple text emails. Back this up
with incremental data also done via text, tack on some encryption so
that the data is safe from prying eyes, and you have a fully
deployable, offline tool that can handle any design that you wish, andd
can stay updated and under your control, with no increase in
infrastructure costs except the consumed bandwidth for sending and
receiving the emails.

My company runs a real shoestring IT group and infrastructure. To get
them to shell out for an off-the-shelf solution is a no go. It just
wont happen on any large scale, and I need to be able to feed data to
some 200 field personnel. This is the only way I could think of to do
it and not incurr extra costs. We have the developer version of Office
97, so I am legally able to deploy this type of thing, and the run time
files that are needed.

At the start of this I wished that there was an easier way, but now I
am really getting into the project and quite enjoying pushing things to
see how far I can take them. I had certainly never expected to be doing
this with Access 97, but then life has some strange turns...

I have also made the code to extract the rest of the database objects,
pretty easy stuff. Got the code written to send and receive emails
through Lotus Notes now too. So the comms are relatively under control.
Now I am building the prototype rebuild component for the DAO code.
Once I have the proof of concept done and operating, I will clean it
right up and develop the whole thing into a deployable app that can
self maintain and handle the data and structural changes. In the end I
envisage there being two versions of the database, the first is the
master where design changes can be made and "published" with version
control, and then the client version which receives the data, can
request updates and status of / to all objects and data.

I am hoping that the end result is an application that the users can
work with, request changes or new things, and can be given these new
things quickly and easily. At the moment they have nearly 20 different
data tools for different systems. That is in the way too hard basket
for most of them, so I am hoping to give them a simple "consolidat ed"
tool and view of their world. They dont need to know the ins and outs
of Oracle and SQL Server, or OLAP cubes, they just want to do their
jobs, and so I find myself creating this tool. Your average sales guy
or girl really isnt technologically savvy.

I think, in the end, if it really works the way I hope it will, I may
just publish all the code on this thread and make the lives of many
people much much easier. What manager wouldnt want to be able to ask
for a new report on the data, and have it the same day, and distributed
to everyone (if they have permissions to use it) around the world if
need be! Pretty cool for a bit of VBA code, some time, and a now
"outdated" desktop database engine.

I will keep you posted as to the progress.

Any thoughts? Am I completely mad? The line between brilliance and
insanity may be getting more blurred here by the minute..... :-)

Have a great weekend and I will speak to you next week.

Cheers

The Frog :)

Dec 15 '06 #14
The thought had crossed my mind! A real genesis script for the Jet
engine. Its kind of what I am working on, but for a slightly different
purpose.

The goal of all of this is actually quite simple. What I am trying to
create is an access application that can run via the RunTime version,
and is able to be updated remotely with new structural information and
data.

By separating the structural from the data, particularly with the
tabledefs (oops...I still need to do the DB properties!), I am able to
add some very granular security and also minimise the data sent between
the host (probably me having to maintain it), and the remote users.
With some simple version control, and some VBA code to get everything
in check when the client application starts up, I can basically deploy
any data structure, to anybody, via simple text emails. Back this up
with incremental data also done via text, tack on some encryption so
that the data is safe from prying eyes, and you have a fully
deployable, offline tool that can handle any design that you wish, andd
can stay updated and under your control, with no increase in
infrastructure costs except the consumed bandwidth for sending and
receiving the emails.

My company runs a real shoestring IT group and infrastructure. To get
them to shell out for an off-the-shelf solution is a no go. It just
wont happen on any large scale, and I need to be able to feed data to
some 200 field personnel. This is the only way I could think of to do
it and not incurr extra costs. We have the developer version of Office
97, so I am legally able to deploy this type of thing, and the run time
files that are needed.

At the start of this I wished that there was an easier way, but now I
am really getting into the project and quite enjoying pushing things to
see how far I can take them. I had certainly never expected to be doing
this with Access 97, but then life has some strange turns...

I have also made the code to extract the rest of the database objects,
pretty easy stuff. Got the code written to send and receive emails
through Lotus Notes now too. So the comms are relatively under control.
Now I am building the prototype rebuild component for the DAO code.
Once I have the proof of concept done and operating, I will clean it
right up and develop the whole thing into a deployable app that can
self maintain and handle the data and structural changes. In the end I
envisage there being two versions of the database, the first is the
master where design changes can be made and "published" with version
control, and then the client version which receives the data, can
request updates and status of / to all objects and data.

I am hoping that the end result is an application that the users can
work with, request changes or new things, and can be given these new
things quickly and easily. At the moment they have nearly 20 different
data tools for different systems. That is in the way too hard basket
for most of them, so I am hoping to give them a simple "consolidat ed"
tool and view of their world. They dont need to know the ins and outs
of Oracle and SQL Server, or OLAP cubes, they just want to do their
jobs, and so I find myself creating this tool. Your average sales guy
or girl really isnt technologically savvy.

I think, in the end, if it really works the way I hope it will, I may
just publish all the code on this thread and make the lives of many
people much much easier. What manager wouldnt want to be able to ask
for a new report on the data, and have it the same day, and distributed
to everyone (if they have permissions to use it) around the world if
need be! Pretty cool for a bit of VBA code, some time, and a now
"outdated" desktop database engine.

I will keep you posted as to the progress.

Any thoughts? Am I completely mad? The line between brilliance and
insanity may be getting more blurred here by the minute..... :-)

Have a great weekend and I will speak to you next week.

Cheers

The Frog :)

Dec 15 '06 #15
The Frog wrote:
Am I completely mad?
Sure you are, just like every person who dared to dream and who dared
to try.

Why not just sit back with a beer and watch some television?

But, while you do remember that without some other mad person(s) there
would be no television.

Dec 15 '06 #16
.... and no beer !

--
--
Terry Kreft
"Lyle Fairfield" <ly***********@ aim.comwrote in message
news:11******** **************@ 16g2000cwy.goog legroups.com...
The Frog wrote:
>Am I completely mad?

Sure you are, just like every person who dared to dream and who dared
to try.

Why not just sit back with a beer and watch some television?

But, while you do remember that without some other mad person(s) there
would be no television.

Dec 20 '06 #17
Just an update to all on the project here....still underway. Hasnt been
forgotten. Christmas got in the way, and well, I got too fat to reach
my keyboard from all that yummy christmas food.

Anyway, I am back at work and will attempt to finish the data IO and
versioning methodology over the next month. I have another project that
has to take priority for now, but it should only take a week or so to
accomplish.

Hope you had a great Christmas and New Years.

Hopefully posting some (useful) code soon.

Cheers The Frog

Jan 12 '07 #18

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
2958
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
3363
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
3187
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
18419
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
8533
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
1782
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
9602
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9439
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
10237
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
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7431
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
5326
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
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
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
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.