Parameter Query In A Macro
Aug 22, 2006
I have a button in a Form which on being clicked runs a Macro containing the action of opening a parameter query. When this Macro is run, the optition to enter data into the parameter query is shown and providing a user enters valid data, there is no problem.
However, if the user cancels the action at this point (by clicking the Cancel button etc.), he is shown an "Action Failed" box with the optition to "Halt".
Whilst this does work, I imagine there is a more elelgant solution for catching & dealing with a "cancelled by user" response.
Any advice on how would be most welcome.
Colin
View Replies
ADVERTISEMENT
Mar 24, 2006
I have devolved two reports which receive their data from the same query. I could not fit everything in one report as I am limited by Access’ 22 inch limitation. I would like to enable a user to run the reports off a Macro. The report/query requires the user to enter a “Parameter Value” such as date and facility number. When running the Macro it requires the user to input the same “Parameter Values” twice, once for each report. What I would like the Macro to do is only request the Parameter Values once. Is there a simple way to achieve this? Thanks for any assistance.
View 2 Replies
View Related
Jul 16, 2014
I am creating a ImportExportData macro that will link to my tables in the BE
However the BE has a password. I was told this would require coding.
I have even tried to 'convert macro to VB' and i get this:
Code:
DoCmd.TransferDatabase acLink, "Microsoft Access", "c: est.accdb", acTable, "Table1", "Table1", False
I then tried to enter the password in the last segment (StoreLogin) ie:
Code:
DoCmd.TransferDatabase acLink, "Microsoft Access", "c: est.accdb", acTable, "Table1", "Table1", False, "PASSWORD"
but that didn't work either, i got a "An expresiions you entered is the wrong data type for one of the arguments"...
View 2 Replies
View Related
Jul 12, 2005
I have a form whose data source is a select query, q3, that is built from 2 other select queries. I'll call them q1, q2, and q3. q1 is a parameter query where I enter a "Cutoff Date" that the 3 queries manipulte and generate the desired results that appear in the form. The problem is that I don't know how to capture the parameter "Cutoff Date" from q1 to display on the form.
View 2 Replies
View Related
Dec 8, 2013
I am trying to write a more complex macro that will start another macro at a preset time, however I am getting stopped at the first hurdle - getting a macro to run another macro.
Here is the code i am using at the moment, all I want to do currently is click the first button, then get the second macro to execute. But no luck, getting error 2157 "cannot find the procedure"
Code:
Private Sub Command3_Click()
MsgBox "1st macro running", vbExclamation, "Note"
Application.Run "teststart1"
' Application.OnTime TimeValue("19:55:00"), "teststart1"
[code]....
View 1 Replies
View Related
Nov 9, 2006
Hi,
I have a query that requires a Start-Date and an End-Date to be input by user for the Where clause. It is asking for both over and over. I've had it ask from 1 up to 4 times! :eek: Shouldn't it store the input and only ask for it once? I'm thinking that the way my query is arranged may be causing it to have to loop through that section more than once to find the data, but that's just my theory. Any help would be great!
Here is my code (abbreviated slightly):
SELECT DISTINCTROW C1.*, C2.*
FROM Pen AS C1 INNER JOIN Jobs AS C2 ON C1.subno=C2.[Jobs Acct]
WHERE ((C1.typ="SS" Or C1.typ="CC" Or C1.typ="PP" Or C1.typ="TT") And C1.stdate>=[Enter Start Date] And C1.stdate<=[Enter End Date] And C2.[Type]<>"EE" And C2.[Type]<>"QQ" And C1.entdate<=C2.[ChangeDate]+60);
I'm selecting rows from "Pen" and "Jobs" that have the same subno/Jobs Acct numbers (text), then there are criteria for "Pen" types, user inputs criteria for date range (Start Date and End Date) and there are criteria for "Jobs" types. Finally, there's a cross-table criteria based on a date field ("Pen" entdate should not be more than 60 days past the "Jobs" ChangeDate). Tables are in quotes in my explanation here.
So running the above, it asks for user input "Enter Start Date", then again for "Enter End Date"...but then it asks for each again...and again...and sometimes again!
Help! :confused:
P.S..I didn't notice this repeating until I made it user input (parameter query) because it was using whatever dates I hard-coded in there before.
View 2 Replies
View Related
Feb 18, 2005
Not sure where to put this one... So I'll go with forms...
I have a form "Reports Dialog" with 3 radio buttons to pick which report you want to preview and/or print. It works fine. Now what I want to do is add a subform"Select", visable only when the radio button is clicked on. This holds the parameters for the query for the item whose radio button you picked. So I set the subform visable to "NO"
Whats the best way to make it visable when the radio button is clicked? Can I do it in a Macro? Or is it better to put a line of VB in..... And I'm not good with VB yet....... So if that is it what would the code be.
Thanks
View 2 Replies
View Related
Oct 7, 2004
How can I make a query or maybe its a macro that can
fill up a form after I enter some information, like the customer
id (i.e. social security). However, if its a new one, than I want
to be able to enter the new information for that new customer.
I really need this guys, can someone help me here?
Thanks,
Enivaldo
View 1 Replies
View Related
Dec 3, 2007
ne1 help me with a find and replace query or macro. What I'm trying to do is shorten the path to external PDF files after I inport them into field TxtPDFPath.
Example; after inport of files path reads
c:w2kdatapdffiles2005somepdf.pdf
c:w2kdatapdffiles2005januarysomeother.pdf
c:w2kdatapdffiles2006another.pdf
I would like to shorten all imported paths to
pdffileswhatever
Example;
pdffiles2005somepdf.pdf
pdffiles2005januarysomeother.pdf
pdffiles2006another.pdf
and so on
View 13 Replies
View Related
Dec 20, 2005
My database contains information on many different power plants. I have created a form to retrieve data about a specific plant but there is more information than I can get onto a single page. So I added a command button to the form to retrieve a subset of data using a query. Clicking the command button is supposed run a macro that activates a query with the plant ID number as a condition to recall the specific subset. The query works fine by itself (if I enter the plant ID manually as parameter). When I click on the command button, nothing happens - I do not even get an error message to suggest where to start looking. Anybody have any suggestions? Thanks.
View 5 Replies
View Related
Aug 11, 2006
Hello, I have a form that I will need to allow users to be able to go back and find a specific record and edit it. I have a control number to uniquely identify each record. I have a main data entry form where the subform has the unique value in it. Can I run a macro to ask the user what control number they are looking for and then open the data entry form to that specific record?
View 1 Replies
View Related
Sep 23, 2007
i am having a table like this :
Phone No......Bill Date.......Amount
_____________________________
222000........12-02-07.......5689/-
Null value.....12-04-07.......2356/-
223223........12-03-07........568/-
Null value.....12-05-07.......1256/-
224224........12-01-07.........568/-
225225........12-07-07.........125/-
Now my requirement is like this:-
''if any field contains null value then repeat the previous value otherwise keep the original value''. Could anyone solve this problem either by query or macro for access 2003?
View 1 Replies
View Related
Mar 26, 2008
I have managed to build a macro that will run a query I have in Access but what I would like to do is be able to change some of the query criteria using the macro script or any other way possible.
Is this possible?
Thanks
View 1 Replies
View Related
Aug 19, 2013
(I'm not sure if this belongs in the macro or query forum)
I have a macro that opens 15 queries and ends with opening a report.
The final query asks the user to type in beginning date, then an end date. Now when there's a data mismatch (i.e., he spells feburary), the macro halts. No harm no foul, they can just click the command button again, but I'd rather not.
What I'd like to do is place a msgbox (i.e., "Check Your Spelling") and then reroute them back to the query.
View 2 Replies
View Related
Aug 25, 2012
I have a MS Access append query that updates a table from a linked Excel spreadsheet. Im trying to automate the running of the query during the night.
Ive tried a couple of ways to schedule the task with Windows Task Scheduler, although each time, it appears to start the job, but then just hang (task never completes, doesnt run the query or macro and when I log back into Windows, the msaccess.exe process is running).
Methods Ive used are:
- command line with /x macroname
- vbs script which runs the query / macro
Code:
'Read from a Microsoft ACCESS database
Option Explicit
dim oaccess
'execute another Access macro
set oaccess = createobject("access.application")
oaccess.opencurrentdatabase "H:Database.mdb"
oaccess.docmd.setwarnings false
oaccess.DoCmd.RunMacro "Macro1"
oaccess.docmd.setwarnings true
oaccess.closecurrentdatabase
oaccess.quit
set oaccess=nothing
WScript.Quit(0)
- .bat file which just has the command line in it.They all run fine when I am logged in, although it seems to hang when I am logged off the network. I have the correct permissions as Ive scheduled a Excel macro to run and its fine.
View 4 Replies
View Related
Oct 15, 2013
Is there anyway to reset a query or macro when you open a new record? My database seems to be holding on to data from the previous record. The data is gained from two queries and one macro.
View 1 Replies
View Related
Jan 16, 2013
I've been creating a simple macro which will append data and then delete data from a table.The criteria for the queries is found in a form, and this is used as a paramter.However, when i run this all as a macro...the append and delete queries somehow can't read the criteria in the form. Rather...i have to type in the criteria again...and then it works.I have attached a copy of my DB.
1. Go to frmArchiveStock
2. Select a stock from the combo box (this the criteria for the append and delete queries)
3. Click the button to run macro mcrStockArchive.
How can i get the queries to pick up the value entered in the form to act as a criteria when they run?
View 1 Replies
View Related
Jan 1, 2015
I have 3 different "buttons" on my form that run individual update queries. I know these update queries are running correctly. Decided to make a macro that will allow me to run all these queries by clicking one macro button.
My question is: Is there some way to stop the pop up msg that advises I am about to run an update query and the next pop up msg that informs me of how many rows I am going to update?
These pop up boxes are starting to drive me crazy when I run the macro.
View 5 Replies
View Related
Apr 19, 2012
Am working with Access 2007. I have built a macro that opens several make table queries and exports the tables to excel spreadsheets. Macro functions properly, however the query results still show in the access database screen. What macro command can I use to close these screens after the action is done? I use the CLOSE command for each query but the results still show in the Access window.
View 2 Replies
View Related
Aug 9, 2012
I have a macro that needs to run repeatedly until the number of records in a query =0 but I can't seem to get the Repeat Expression set properly.
My query is called sqMatchCount:
SELECT Count(sqCompare_Parts_Matched_1st.BRP_Entry_Num) AS MatchCount
FROM sqCompare_Parts_Matched_1st;
The theory is if I don't have any more matches then I do not want the macro to run any more. In other words, MatchCount will = 0 when there are no more matches.
I have tried a variety of syntax using DCount in the Repeat Expression:
=DCount("*","sqMatchCount") ...... Macro runs in a continuous loop
DCount("*","sqMatchCount")=0 ...... Macro does not run (although I thought a couple times it actually DID run with this syntax)
DCount("MatchCount","sqMatchCount")=0 ...... Macro does not run
=DCount("MatchCount","sqMatchCount")=0 ....... Macro does not run
=DCount("MatchCount","sqMatchCount") ....... Macro runs in a continuous loop
What IS the proper way to write this Repeat Expression for the RunMacro Action if I want it to run as long as sqMatchCount.MatchCount>0?
View 14 Replies
View Related
Sep 30, 2013
Is it possible to have a macro button to pass query results to a listbox? I have a database where I have some fields with dates. What I need to do is to show a list of all cases that have a start date (and also the end date). So I will have 2 buttons, one that says "show started cases" and second one "show closed cases". If I press the first button, it will run a query and show only those cases that have a date filled in the started case field. I made a button that shows the results in a report, but I would like to have it show up in a listbox so I can double click it and go straight to the case.
View 14 Replies
View Related
Aug 2, 2013
I have a query run that gives me a list of records that I view on a continuos form. What I want is to press a button and run a macro/Append Query to add a Single Summary record to another table.
For example my query spits out this data
Part # Quantity Serial Number
GO2 1 123
GO2 2 456
GO2 2 789
What I'm looking to get is
Part Number Total Quantity Serial Number 1 Serial Number 2 ..
GO2 5 123 456
I'm stuck on a couple of things.
1. Getting a new single row to append.
2. Getting Serial Numbers from several records to save on to a single record.
View 4 Replies
View Related
Jul 28, 2005
Hi All,
How can I check the Parameter query interval is out of range?
Details:
I have a table with Date column. With parameter query(by Date field) I extract records between two dates. How could I make a check when taping in Inputboxes, am I or Not Between the Last and the First Date?
Thanks!
View 1 Replies
View Related
Aug 31, 2005
I'm writing a query which when run will prompt the user to enter criteria. In this case it is a workers id (like 000UA or 000UB)
My problem is I would like to have the ability to enter more than one criteria. What I want to do is to have the ability to enter several worker id's in the criteria field, like 000UA, 000UB, 000UC, 000UD, 000VA, 000VB, 000VE, 000VF, 000WA, 00WB
Is this possible and can someone explain to me how to do it?
Thanks
View 2 Replies
View Related
Sep 2, 2005
I am trying to run a parameter query that will prompt the user for "facility", but instead of displaying the results in table format, I want a form to display the results. I have already developed the form. I would also rather for the users to search by a list box instead of typing the facility. I cannot seem to figure this out. Please help.
Thanks.
View 1 Replies
View Related
Oct 19, 2005
Dear All,
I am having problems finding a solution to this problem. I am working on 3 databases at the moment..and am at the final hurdle to complete it.
I have built an Access database. I would like to generate a
number of reports which have to be exported directly into excel
individually.
I have a parameter query with 14 columns. One of the columns
is called GROUPS. I have a form with a button.
When you click on the button the parameter query asks for the
parameter value.
The parameter value must be a GROUP. i.e BURR, WIEN.
After you enter the group the parameter query generates results for
that particular group.
I have a number of groups which i would like to generate results
for at the click of the button on the form.
There are around 30 groups. but i only need to generate reports for
about 15 groups. The groups are stored in one of the tables.
So for instance after i click a button on the form
the results for each requested "GROUP" are exported individually into
excel.
Each group result must be in one excel file.
How can i achieved this. Do i need to use VBA? Please can you help.
I need a solution then i can apply this to a number of databases
Many, Many thanks
View 1 Replies
View Related