473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

archive macro

I'm trying to put together a macro that queries my cell phone call expense
DB the selects records as of a specific Date that are not marked "Archive",
prints a report, then marks the records "Archive".

I've worked out the Queries and the report and even got them into the macro
but I can't figure out how to set up the Macro to prompt for ONE Date.
Instead I get a prompt for the Select Query date and then again for the
Update Query date. It's the same date. Surely there is a simple one to
input the date once.

Thanks

Robert
Nov 13 '05 #1
5 1986
I'm no expert but what I would do is create a temp table for the date. When
you want to run your macro, I would run a query that deletes the temp date,
open up a form similar in shape to an input box which is bound to the temp
table. Then once the date is entered, the form would close starting your
macro which you already have. Change both your select and update queries to
they lookup the date in your temp table. This way, you would only have to
enter the date once!!!

Mark

"Comcast Newsgroups" <ro***@email.com> wrote in message
news:M9********************@comcast.com...
I'm trying to put together a macro that queries my cell phone call expense
DB the selects records as of a specific Date that are not marked "Archive",
prints a report, then marks the records "Archive".

I've worked out the Queries and the report and even got them into the macro
but I can't figure out how to set up the Macro to prompt for ONE Date.
Instead I get a prompt for the Select Query date and then again for the
Update Query date. It's the same date. Surely there is a simple one to
input the date once.

Thanks

Robert

Nov 13 '05 #2
One way is to point your query at a field on a form (no recordsource
behind it - it's just used to clllect query parameter values). So you
have a text field on your form that is formatted as a date, and then
pass that to the query.

SELECT ...
FROM MyTable
WHERE SomeDate = Forms![MyForm]![txtDate]
AND RecordStatus<>"Archive";

then if you turn that into an update query...
UPDATE MyTable
SET SomeDate = Forms![MyForm]![txtDate]
WHERE RecordStatus<>"Archive";

the filter stuff isn't quite right, I'm sure, but it should give you
some ideas.

if you point your queries at the form, then you can drop your macro
onto the form (in design view) and it'll add a button to execute it.
Once it's all working right, you' might want to shut off the warnings
and turn them back on when you're done.

DoCmd.SetWarnings False
DoCmd.OpenQuery "qappArchiveRecords"
DoCmd.OpenQuery "qupdMarkRecords"
DoCmd.SetWarnings True

Nov 13 '05 #3
I was playing around with that because it does make sense to me. But I'm
stumped as to how to get the CutOffDate from my Form to the Queries??? Do
I have to create a temporary underlying, Table as Mark suggested, just to
hold that CutOffDate while I run my Queries? Or can I somehow Select the
CutOffDate right from the Form and pass it through to the Queries that I'm
using in my Macro?
Or can I just use the Conditions feature of Macros to get my Date? I've
been playing around with something like this, but Access complains that it
doesn't know what [Tables] is. I created my Phone Log Cutoff Date with only
a TextBox to hold a date then I put the following into the Condtion line of
my Macro:
[Tables]![Phone Log Minutes].[Date & Time]<[Forms]![Phone Log Cutoff
Date]![CutOffDate]
Even if it did work, I'm still puzzled as to how to pass the CutOffDate to
my Query.

Thanks
Robert

<pi********@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
One way is to point your query at a field on a form (no recordsource
behind it - it's just used to clllect query parameter values). So you
have a text field on your form that is formatted as a date, and then
pass that to the query.

SELECT ...
FROM MyTable
WHERE SomeDate = Forms![MyForm]![txtDate]
AND RecordStatus<>"Archive";

then if you turn that into an update query...
UPDATE MyTable
SET SomeDate = Forms![MyForm]![txtDate]
WHERE RecordStatus<>"Archive";

the filter stuff isn't quite right, I'm sure, but it should give you
some ideas.

if you point your queries at the form, then you can drop your macro
onto the form (in design view) and it'll add a button to execute it.
Once it's all working right, you' might want to shut off the warnings
and turn them back on when you're done.

DoCmd.SetWarnings False
DoCmd.OpenQuery "qappArchiveRecords"
DoCmd.OpenQuery "qupdMarkRecords"
DoCmd.SetWarnings True

Nov 13 '05 #4
Robert,
The easiest way to implement what I suggested is to use a blank form
and drop a textbox control on it and format the contents as a date.
Then once that form saved, you can use it to collect your criteria.
Say the form is called "frmCollectDate" On that form, say the textbox
control is called txtDate. (If you want, go ahead and slap one
together - that's
probably the easiest way to understand it.) Save the form and open it
in normal view, so you can enter data into the date field.

then create a query based on your table. Then click on the criteria
line of your query. Then click on the wand and you should be able to
navigate the objects in your database. Choose the forms folder, and
the open form should show up there. Select the txtDate field. That
should give you what you want. If you're still stuck I can send you a
quick example. Once you understand how to do it, this is a walk.

Nov 13 '05 #5
Most excellent! Works like a charm. I was very close to getting it but it
just wasn't quite there.

Thanks

<pi********@hotmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Robert,
The easiest way to implement what I suggested is to use a blank form
and drop a textbox control on it and format the contents as a date.
Then once that form saved, you can use it to collect your criteria.
Say the form is called "frmCollectDate" On that form, say the textbox
control is called txtDate. (If you want, go ahead and slap one
together - that's
probably the easiest way to understand it.) Save the form and open it
in normal view, so you can enter data into the date field.

then create a query based on your table. Then click on the criteria
line of your query. Then click on the wand and you should be able to
navigate the objects in your database. Choose the forms folder, and
the open form should show up there. Select the txtDate field. That
should give you what you want. If you're still stuck I can send you a
quick example. Once you understand how to do it, this is a walk.

Nov 13 '05 #6

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

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
0
by: Евгений Косенко | last post by:
Hi! I need to fresh a zip-archive using zipfile. However, it seems it is no function to fresh the archive. When I use the append-mode of ZipFile, the written file is merely appended to the...
1
by: DB2 Convert | last post by:
Hi, A few points to confirm as I am still new with DB2. 1. What will happen if archive logging is used, however there is no userexit or manual process to move those online archived logs to...
7
by: William | last post by:
I am using DB2 8.2 on RH Linux 8.0. I just compiled db2uext2.c but failed to archive the log files, did anybody fix this problem before? TIA db2diag.log 2005-06-12-12.39.52.305630-240...
2
by: Pete | last post by:
In Access 95/97 I used to be able to create pull down menus (File,Edit ...) from a macro. It seems there used to be some wizard for that. However in Access 2000 it seems you have to build your...
7
by: Newbie_sw2003 | last post by:
Where should I use them? I am giving you my understandings. Please correct me if I am wrong: MACRO: e.g.:#define ref-name 99 The code is substituted by the MACRO ref-name. So no overhead....
3
by: Alexander Ulyanov | last post by:
Hi all. Is it possible to pass the whole blocks of code (possibly including " and ,) as macro parameters? I want to do something like: MACRO(FOO, "Foo", "return "Foobar";", "foo();...
7
by: Enigma Curry | last post by:
I need to store a large number of files in an archive. From Python, I need to be able to create an archive, put files into it, modify files that are already in it, and delete files already in it. ...
2
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
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...

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.