473,756 Members | 8,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I label queries so the can be copied with VBA? Confused!

I have two versions of a database front end and want to be able to use
docmd.copy (or some other method) to move a bunch of queries.

I was able to use the '.tag' property to of forms and reports to move
them using code. For example, first I put the word "Special" in the
..tag property of my reports (or forms), then I use the following
procedure:

Sub CopyReps()

Dim db As Database
Dim con As Container
Dim doc As Document
Dim rpt As Report
Dim strReportName As String

Set db = CurrentDb
Set con = db.Containers(" Reports")

For Each doc In con.Documents
strReportName = doc.Name
DoCmd.OpenRepor t strReportName, acViewDesign
Set rpt = Reports(strRepo rtName)
If rpt.Tag = "Special" Then
DoCmd.CopyObjec t "DestinationDat abase.mdb", strReportName ,
acReport, strReportName
End If
DoCmd.Close acReport, strReportName
Set rpt = Nothing
Next doc
End Sub

I know this isn't very elegant, but it seems to work. Is a way to do
the same with queries. I have a dozen or so 'special 'queries buried
in the 600 some odd queries in my application and would love to be
able to move them in one fell swoop whenever I update my front end.

Is there some property of queries I can tag so that my code can find
and move them? Should I take a different strategy? For example, is
there a way to use code to address the members of a 'Group' in the
database window?

Thanks in advance for the help!
Jim
Nov 13 '05 #1
1 1433
You can create custom properties for QueryDefs, so you can give them a "Tag"
with CreateProperty( ).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"j.mandala" <ma*****@rci.ru tgers.edu> wrote in message
news:6c******** *************** ***@posting.goo gle.com...
I have two versions of a database front end and want to be able to use
docmd.copy (or some other method) to move a bunch of queries.

I was able to use the '.tag' property to of forms and reports to move
them using code. For example, first I put the word "Special" in the
.tag property of my reports (or forms), then I use the following
procedure:

Sub CopyReps()

Dim db As Database
Dim con As Container
Dim doc As Document
Dim rpt As Report
Dim strReportName As String

Set db = CurrentDb
Set con = db.Containers(" Reports")

For Each doc In con.Documents
strReportName = doc.Name
DoCmd.OpenRepor t strReportName, acViewDesign
Set rpt = Reports(strRepo rtName)
If rpt.Tag = "Special" Then
DoCmd.CopyObjec t "DestinationDat abase.mdb", strReportName ,
acReport, strReportName
End If
DoCmd.Close acReport, strReportName
Set rpt = Nothing
Next doc
End Sub

I know this isn't very elegant, but it seems to work. Is a way to do
the same with queries. I have a dozen or so 'special 'queries buried
in the 600 some odd queries in my application and would love to be
able to move them in one fell swoop whenever I update my front end.

Is there some property of queries I can tag so that my code can find
and move them? Should I take a different strategy? For example, is
there a way to use code to address the members of a 'Group' in the
database window?

Thanks in advance for the help!
Jim

Nov 13 '05 #2

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

Similar topics

10
2350
by: Marco Alting | last post by:
Hi, I'm still confused about my queries, I want to do something is ASP that is easily done in Access. I'll post the Access queries below as a reference. The main idea is that the queries depend on each other in a hierarchical manner. It all works fine in Access, but in the last query (Qrylevel3CostTotals) there's a criteria which I would like to set from an HTML form and thats where I am confused! How do I make this work in an ASP...
6
6782
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
3
4117
by: RC | last post by:
I am using docmd.printout to send Reports (formatted as labels) to a barcode label printer. I need to collate the labels so that I print lable 1 twice, then label 2 twice, then label 3 twice, etc. The printout collate option only seems to work if the printer supports it. The label printer I am using doesn't collate via the printout command option, but it does have a command language that will collate IF I can find a way to send the...
5
2361
by: KitKat | last post by:
I've got two queries; one is a modification of an older query; the other I created from scratch. The old one is about 5 copies down the road from something that has been expandable when I'm in View mode--it showed the Points of Contact for records whose Begin Date was in a form-selected (or manually inputted) year. That used to be all it did. Then copied it, took out the year criterion, and changed "POC" to show the Director field...
8
1931
by: Arpan | last post by:
Consider the following code snippet (my main intention is to display the current time in a Label control as & when this ASPX page is accessed/refreshed): <script runat="server"> Class Clock Sub SetTime(ByVal intSec As Integer, ByVal intMin As Integer, ByVal intHour As Integer) Dim lblTime As New System.Web.UI.WebControls.Label lblTime.Text = "Current Time: " & intHour & ":" & intMin &
3
2091
by: peter.meth | last post by:
Hi All, I am making a file manager type of application and am trying to duplicate Windows Explorer's behaviour when copying files; ie, display a second form with the copy files animation. As it is copying files, it should show the file name and folder. For testing purposes I am sleeping for 1 second to simulate a file being copied. My problem is that when I run the code, the labels do not change to reflect the file names until the...
3
6288
by: KenMacksey | last post by:
Hi I am running VB6 on a pentium 4 and Win XP pro. I wrote a small program to copy files to a memory card or mp3 player etc in a specific order or a random order instead of the windows default alphabetical order. Because the files take about 1 second to be copied, if there are 150 files, it takes about 150 seconds to copy them all. During this time, it appears as if nothing is happening, so I use a label that is constantly updated and...
2
2602
by: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post by:
Hi, I have a Label on a Windows form (Version 1.1.4322) and while I iterate recursively through a method I want to show the name of the current file being copied to another directory. The Label is not visible until the backup begins, at which point I resize the form to show the Label and a ProgressBar. As each file is copied, the Label is updated:
4
5884
by: Henrootje | last post by:
I have a REPORT with in it a subFORM Now I have this label (lblMonth) that I want to change. How should I do this? What would be the proper event to do this? The lblMonth should contain the name of the month as jan 07 Any ideas?
1
9779
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
9645
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
8645
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
7186
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
6473
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
5247
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3742
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
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2612
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.