473,473 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is it Possible to implement Dynamic changes to a Table based on database's tablelist?

RLindahl
13 New Member
Greetings,

My apologies for the poor english in the title, 85 characters was insufficient to ask my question.

I have a table which I'm using for a custom switchboard. This table has three columns; ID, Name, and Argument.
The "Name" column holds the names of tables and reports. The "Argument" column is the name of the form or report to open. What I am trying to do is

1). Populate the "Name" Column with the list of tables and reports in my database automatically. I can use a Schema(ADO) to get the tables but I don't know how to get the reports.

2). I need the "Name" Column to also have the proper "Argument". If a table name changes, then using the TableSchema will give me a different list order(since the tables are listed alphabetically).

Is this possible? Or am I better off making the switchboard table a static list and manually changing the "Name" column if a table/report's name is changed in the DB?

A side note:

The buttons on my switchboard dynamically read the "Name" and "Argument" fields of a record so changes will reflect automatically on the button.

Thank you for your Time and Assistance,

RL
Jan 8 '13 #1
9 1840
ADezii
8,834 Recognized Expert Expert
It is a simple matter to retrieve a list of all Reports in a Database and populate a Table with their Names using the AllReports Collection:
Expand|Select|Wrap|Line Numbers
  1. Dim obj As AccessObject
  2. Dim dbs As Object
  3.  
  4. Set dbs = Application.CurrentProject
  5.  
  6. For Each obj In dbs.AllReports
  7.   CurrentDb.Execute "INSERT INTO Table1 (Name) VALUES ('" & _
  8.                      obj.Name & "')", dbFailOnError
  9. Next obj
  10.  
Jan 8 '13 #2
NeoPa
32,556 Recognized Expert Moderator MVP
CurrentProject().AllReports() will list all the Report objects and CurrentDb().Tabledefs() will list all the Tables (TableDef objects). I don't see from your explanation (which is quality IMO) how you plan to tie the [Argument] value to a [Name] automatically. It's all very well thinking of how to do something in code, but first you need a clear idea of exactly what it is you intend to achieve. That part seems to be missing.

PS. Thanks for the effort to make the title make sense. It wasn't easy in the circumstances, but you did as good a job as possible.
Jan 9 '13 #3
RLindahl
13 New Member
@ADezii
Thank you for the reply. Is there a way to list all Reports using ADO(or DAO for that matter)? I am already using ADO for the tables which is why I am wondering. If not I guess I will just rework things.

Thank you for your time and assistance.

RL
Jan 9 '13 #4
RLindahl
13 New Member
@NeoPa
Thank you for your Reply. I tried my best to make the question and post as concise as I could. I appreciate the assistance I have received and don't wish to waste people's time. :)

The reports have the same [Name]s as their [Argument]s so I should be able to just add the [Argument] at the same time as the [Name]. As for the table [Name]s and the [Argument]s I do not know. I am not sure it is possible. I have been racking my brain the past few days with this.

I am thinking that I would have to somehow store the table name and the form name then when the table name changes transfer the form name from the old connection to the new one. Perhaps utilizing a string concatenated from Name and Argument then take the Argument part to concatenate to the new Name. How to figure out when the name changes would be another issue.

Even if I can find a way to tie them together, changing the table name messes with the table's form. So I would also have to find a way to make the forms use the updated name too.

In your opinion is this feasible?

Thank you for your time and assistance,

RL
Jan 9 '13 #5
NeoPa
32,556 Recognized Expert Moderator MVP
RLindahl:
In your opinion, is this feasible?
Not from what you've said so far no. Until you have a clear logical understanding of how things fit together it is not possible to put that understanding into code. There appears to be no clear logic either for matching table names to arguments or for matching old table names to new table names whenever they are changed. Without either, I fear there is no logical path even to try to follow :-(
Jan 9 '13 #6
RLindahl
13 New Member
@NeoPa
Well at least I learned something new even if I could not do what I had hoped. Thank you very much for the assistance and insights.

RL
Jan 10 '13 #7
NeoPa
32,556 Recognized Expert Moderator MVP
I know I can speak for ADezii when I say it was our pleasure :-)
Jan 10 '13 #8
ADezii
8,834 Recognized Expert Expert
Is there a way to list all Reports using ADO(or DAO for that matter)?
You can actually accomplish this using no External References whatsoever:
Expand|Select|Wrap|Line Numbers
  1. Dim intCtr As Integer
  2.  
  3. With CurrentDb
  4.   For intCtr = 0 To (.Containers("Reports").Documents.Count - 1)
  5.     Debug.Print "Report#" & CStr(intCtr + 1) & ": " & _
  6.                  .Containers("Reports").Documents(intCtr).Name
  7.   Next
  8. End With
  9.  
OUTPUT:
Expand|Select|Wrap|Line Numbers
  1. Report#1: rpt2weeks
  2. Report#2: rptCirclesDemo
  3. Report#3: rptCirclesDemo_Good
  4. Report#4: rptOrderDetails
Jan 10 '13 #9
NeoPa
32,556 Recognized Expert Moderator MVP
Sorry ADezii, but CurrentDb(), though it is available from Access.Application, is a method that returns a Database object defined by the DAO library. Thus every object within there is also DAO relative.

I suspect you've tested this, and it probably does work without the reference (as many object references can), but as it uses DAO objects so heavily the reference, though maybe not absolutely necessary, would certainly be desirable.
Jan 10 '13 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: dixie | last post by:
If I have two compatible tables, but in two separate databases, can I append the records in one table onto the records in the other by code in either a module or a form. If the two databases were...
2
by: RSH | last post by:
I am struggling a bit trying to get at all of the Table names in a given Access database. I have the code below which should be retrieving the information...i am just having a bit of trouble...
9
by: Jimbo | last post by:
Hello, I have a user request to build a form in an Access database where the user can check off specific fields to pull in a query. For example, let's say I have 10 fields in a table. The user...
21
by: Kristaps | last post by:
Hi everyone! I have some questions, maybe someone can help me... I write script for table comparing, but it works wery slovly. There is the script, can anyone give some tip how can I make this...
0
by: quantumlady | last post by:
Hi, All. I am working on a project with another student that will be used on Oracle, MySWL and DB2 databases. We have completed all the basic functions, but I would like to see if we can improve...
0
by: dawnyankee via AccessMonster.com | last post by:
I adapted the code below from steve.minnaar (can't thank you enough) for a table that contains data dating back to 2002 and it works excellent for my hours and amount fields, but the table also...
3
by: prokopis | last post by:
i have a small problem. am writting a program in c# with sql server this that i want is to take a particular row from the database and put all the fields of that row to a 2d array example database...
0
by: lee.walczak | last post by:
Hi, I hope someone can help here. I have made lots of progress implementing a gui application which at present uses the TableList python wrapper to interface with Tcl TableList implemention. ...
2
by: lee.walczak | last post by:
Hi, I am using Tkinter & the Kevin Walzer's TableList Wrapper for python implemented GUI: http://tkinter.unpythonic.net/wiki/TableListWrapper The TableList has been extremely useful in...
0
by: lee.walczak | last post by:
I actually post a topic relating to my problem here: (http://groups.google.co.uk/group/comp.lang.python/browse_thread/ thread/a073d532c4481bfe?hl=en# ) But I thought it could be useful to...
0
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...
0
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,...
0
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...
0
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,...
1
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...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.