Changing A Query....
Oct 9, 2005
in my assignment, I am told to change my prior query by continuing to display the sum, average, and pledge numbers. what is required, is for me to display these totals by the names of the pledges, not just a grand total. how can I sort the query by name?
View Replies
ADVERTISEMENT
Feb 8, 2005
OK…procedurally I know I am probably doing this wrong, but that is the way the database is set up…so let me try to explain.
Query A has the same fields as Query B. Query B has two fields which are parameter values (i.e. when you run the query, Access prompts you to enter two values). Query A gets these values from a table.
The process I have for getting a report depends upon whether I wish to hard code the values of the report in, or whether I wish to use the information from the table that Query A uses.
Depending upon my choice I end up renaming Query A or Query B to Query C.
All of my subsequent queries utilize the information in Query C to make the necessary calculations and data massaging in order to spit out a Report.
What I would like to do is have a toggle control/radio button (on a form), which will rename Query A to Query C or Query B to Query C, depending upon which choice I click on the toggle button.
My issue is I do not know how to change the name of a Query in VBA. I tried to look up how to do it using [DoCmd.RunCommand acCmdRename], but I couldn’t find any examples which would help and don’t even know if this is how I should go about renaming these queries.
I hope I’ve explained myself correctly… Does anyone have a clue as to how I could do this?
Thanks in advance…
Gary
View 4 Replies
View Related
Feb 11, 2005
Hello,
I have a query that I want to run for multiple tables of the same structure. Instead of creating a query for each table, is there any way that I can write some code or SQL statement that will change the table that the query is using? Thanks!
G
View 6 Replies
View Related
Apr 9, 2015
So I have created a select query and I am using it as an all purpose search query. I plan on changing the value of SQL in the query based upon what the user selects as the method of searching. So there is a drop down menu, that allows the user to select the method, this will be expanded in the future but for now till I get this working I am not going to bother with that. That being said, I figure once I get a couple of these the work the others should follow suit. Anyway, here is what I have so far.
Code:
Dim StrSQL As String
Dim qdf As DAO.QueryDef
Select Case Me.Combo3
[code]...
View 6 Replies
View Related
Aug 25, 2005
Hi
Not sure if this is in the right forum. :confused:
But here goes, my question is;
Is it possible to update the criteria by using a form?
What we are looking to accomplish, is a report that prints out labels in relation to the customers that are chosen in the query. What we want the user to be able to enter multiple Company ID's on this form, which are then picked up by the query and the companies name and address printed out via the report.
The printing out of the report from the form we have done.
View 1 Replies
View Related
Apr 10, 2006
Hello,
I'm trying to create navigation buttons that navigate in alphabetical order. I know that the easiest way to do this is by creating a query and using the query as the recordsource for my navigation buttons, but for the life of me I cannot figure out how to actually change to the recordsource to that query for only that navigation button.
I'd appreciate any help
Thank you
PRHC
View 2 Replies
View Related
Jun 22, 2006
Hello,
I am working on a database which has many queries that count different statistics of clients (race,gender,ect) during specific date ranges. I would like to set up a form that you could go in and enter a date range into a text box and it would update the criteria (date range) for each of the queries. How would this be possible? I have looked at some past threads similar to this but they didn't help.
Any help will be greatly appreciated.
View 5 Replies
View Related
Jul 17, 2006
I was wondering if anyone could throw some light on a problem I'm having. I have a straightforward report - record source is a query. The query has some selection criteria which requires input at run time. This works fine ! (Why change this you ask ? I'm beginning to ask myself the same question- but hey !)
The problem occurs when I change the criteria in the query (original requested input of a parameter field - the new criteria points at a combo box on an unbound form). If I then run the report, it asks for 'both' sets of criteria (old and new ) !
I've tried copying both the query and the report (thinking that the original criteria are somehow being stored somewhere ), but I'm still getting the problem.
I guess I'm missing something straightforward but I just can't see it.
Cheers
Steve
View 2 Replies
View Related
Jan 13, 2005
Hi,
I have a form that has a query on it. It acts as a subform. I would like for this query to be able to switch depending on what employee I've got selected on the form. I've tried playing around with the sourceobject property:
Dim name As Variant
name = Forms![Time Input Form]!Employee
Forms![Time Input Form]!Table.SourceObject = name
, but it keeps telling me
"Run-time error '3011':
The Microsoft Jet database engine could not find the object
~sq_cTime Input Form~sq_cTable'. Make sure the object exists and that you spell its name and the path name correctly."
The names directing to the subform are absolutely correct though. I'm just not sure if this is the right property to use.
Anyone have any ideas? Thanks. =)
View 1 Replies
View Related
Mar 9, 2006
I have a query that pulls records from a main table based on a check box and I need a macro or code that will set the field value as if it were unchecked.
BTW I am self-taught and new at this so don't make fun of me if the question seems stupid.
Thanks!
View 8 Replies
View Related
Dec 16, 2014
I have a query, and in order for it to run properly, I've set it to look in an unbound combobox on a form to display the necessary data I want, as long as I never close down the form, this is exactly how I want it.However, if I close this form down, and reopen it, I'm asked by messagebox to get the lookup from a different form's combobox, despite saving the correct form's design over and over again, and saving the actual query, more than once, while in design view.when Access changes the criteria, there isn't even a combobox value on the form it changes to.
View 3 Replies
View Related
Jul 22, 2015
I have a query, "adhocComplete" that has criteria ">=[Forms]![frmAdhoc].[Date] And <=[Forms]![frmAdhoc].[Date2]" for the field [30DayDue].Is there a way of removing the criteria from the query by unchecking a checkbox [Check62] on the form [frmAdhoc] and re-adding the criteria if the checkbox is check?
Code:
Dim qdf As DAO.QueryDef
Dim qdfOLD As String
Set qdf = CurrentDb.QueryDefs("Query1")
[code]....
View 8 Replies
View Related
Jun 26, 2006
Hi,
This query will allow me to view payments that are made between 2 dates. I would like to know how to flip the query around so that it gives me the payments that have not been made. I think this would be described as returning the null values?
The SQL code i have at the momnet is:
SELECT download20060602.Date, download20060602.Description, download20060602.Amount, Members.FirstName, Members.[Mid Name], Members.Surname, Members.[Memb No]
FROM Members LEFT JOIN download20060602 ON Members.description = download20060602.Description
WHERE (((download20060602.Date) Between [Enter Start Date] And [Enter End Date]));
Any help or ideas would be fantastic.
Cheers
Phill
View 3 Replies
View Related
Jul 18, 2006
Hi,
I have two Tables TA and TB. I have a set of queries based on TA. I want to substitute TB for TA (i.e. TB will stand in place of TA). I want the old TA queries remain unchanged but now be based on TB.
If I delete TA and then rename TB into TA, I will lose the queries. Therefore I want to 'point' the queries (in the most efficient way) to TB instead of to TA.
Then I can delete TA. Then I can rename TB into TA and the queries will follow along, I expect.
I have been trying in vain to find a way of pointing the queries to TA instead of TB? How do I do it?
I have done it with Forms (Design Views, Properties), where I can select a datasource. But where is the corresponding thing enabling me to select a datasource for Queries?
Thanks.
Adrian
View 13 Replies
View Related
Aug 17, 2004
I have a Query called Median and all it does is pulls all the fields and all the records from 1 table. Since the Query is connected to a lot of other queries, and the table it's connected to changes twice a month, I was wondering if there was a way to set this up in a form maybe using vb, so a user could maybe Click a new table from a combo box list of current tables in the database, then click a button that says "Change", and it change all the fields to the new table and removes the old table from the query.
Or what might be better is: Already on the form, i have part of the name of the new table already entered by the user (it bases the new name of the new table off this text box). So, what I can use is the Text in that box and an & " the rest of the tablename", and automatically change the table in the Median Query based on that criteria. If that is too complicated, then a combo box will be sufficient.
Another way i guess, would be to setup a hidden field that takes whatever's in my text box (which is a date) and adds " the rest of the tablename", then I could base the replacement table of the Median on that one text box.
Anyway, is there a way to do this?
View 6 Replies
View Related
May 7, 2014
I was trying to see if there is a way to convert text to a hyperlink in a query.
Background : I'm pulling information from a lotus notes database using an OBDC connection and storing it into an access database and using that to upload to a sharepoint site. While we are converting over to a sharepoint site, I was trying to make it easy to get back to the original site for each document to check the work.
One of my columns in the query looks like this:
Code:
Notes Link: "notes://pncpgha66/852570CE0056FEF3/0BFCC83A5C11D7C3852576CD0072ED3E/" & [NoteUNID]
I don't see a way to convert that whole part to a hyperlink though. Like I could with a date and text. Cdate().
View 1 Replies
View Related
Apr 24, 2013
i have an update query that looks for a product number, updates the cost, and re-calculates the price in two columns based on the salesman's margins. the problem i am having is that it seems to be hit and miss on the first run. if you run it again, it runs the calculations on all the fields. (it has to check / recalculate 16,000 rows.) should this query have vba to make it loop thru the table.
here is the basic layout of the query:
table 1 is newproductq
table 2 is Products
Field: PriceIn
Table: newproductq
Update To: [Products].[Cost]
UNITS
newproductq
[PriceIn]/((100-[Margin])/100)
PIECES
newproductq
[PriceIn]/((100-[BrokenMargin]/100)
View 4 Replies
View Related
Oct 11, 2006
Hi
I have some drop downs on my form, which has some code that decides which recordsource to use.
When I first select an option from the drop down, the query takes 10 seconds to load data.
I then select another option, which runs a different query, which takes x seconds.
If I then select the original option from the dropdown, the data loads onto the form in less than a second.
Why is there a delay the first time round and not the next? Has Access saved some kind of query plan? If so, why doesn't it save it permanently?
View 1 Replies
View Related
Dec 3, 2014
I am using an append query to move data into another database. One of the fields being imported is a date field in text form (20141201). I need it appear in the final database in text form (01/12/14) I have tried using several date conversions and cant get this work. Ideally i need the final value as a text rather than date.
View 8 Replies
View Related
Jan 17, 2014
I have a date field NxtAPayDate that I need to update to the same day in the next calendar quarter. I have an update query set up using DATEADD but it does not change the dates. The table name is AutoPay
I am using the Query Design Grid. This is the SQL code behind the query:
UPDATE AutoPay SET AutoPay.NxtAPayDate = DateAdd("q",1,[AutoPay]![NxtAPayDate]);
When I view the results the dates are the same - original dates, when I try to sort the results, I get a message box with the following: syntax error, incomplete query clause?
I cannot get the dates to change by using a specific date either
UPDATE AutoPay SET AutoPay.NxtAPayDate = #1/2/2014#;
View 1 Replies
View Related
Sep 9, 2013
I am trying to run a change an existing query in real time to allow date filtering for 4 different categories. I can get two of them to work. Calibration Date and Icepoint Date. But for The two calculated fields Calibration due date and Icepoint date I cannot get it to filter properly e.g. for 2013 dates it also includes 2014 dates and just does not work properly. I am thinking its due to it being a calculated field but don't have a clue how to fix it. see pasted code for calibration due date filter where Todate and Fromdate are the 2 dates used. I also have the on current code and the exit code to reset the query to its original status.
Public Sub SetDate1()
'Apply date filter and rebuild query in real time
On Error GoTo Err_SetDate1
If IsNull(Me!ToDate) And IsNull(Me!FromDate) Then
MsgBox ("Please Enter Date First"), vbExclamation
GoTo Exit_SetDate1
[code]....
View 3 Replies
View Related
Aug 5, 2013
How do I change the account from which to send the email if I have multiple accounts, or can I?
View 14 Replies
View Related
Jul 13, 2014
I have the following tables:
Supplier
Supplier# [Other columns]
Material
Supplier# Material# [Other columns]
DeliveryHeader
Delivery# Supplier# [Other columns]
DeliveryDetail
Delivery# Supplier# Material# [Other columns]
I've created a form based on table DeliveryHeader with a subform based on table DeliveryDetail. The two are linked by Delivery# Supplier#.
On the form, Supplier# is a combobox that lists all suppliers from table Supplier.
On the subform, Material# is a combobox that lists only the materials supplied by the supplier selected with form's Supplier#.
The problem is that this second list always shows the materials of the first listed supplier. For instance, when the form is loaded, it shows delivery #1 with all its details on the subform. Suppose supplier loaded to form is #1.
1) If I use subform combobox, it shows correctly supplier's #1 materials. But then, whatever delivery I navigate, it always shows supplier's #1 materials.
2) If I navigate to another delivery without using subform combobox, suppose I stop on a delivery where the supplier is #4, then subform combobox shows correctly supplier's #4 materials. But then, once again, whatever delivery I navigate, it always shows supplier's #4 materials.
I've spread Me.Requery here and there but without any success. What trick must I apply to force the execution of the query of the subform combobox Material# each time I navigate to a new record on the form?
View 4 Replies
View Related
Nov 4, 2013
My form has a Record Source of qry_Profile, it is a query that shows the user the records of the dogs that they currently own. I want to put a button in the form footer to allow the user to show the records of all the dogs that they have ever owned.
So my question is how do I change the record source with vb.
View 1 Replies
View Related
Oct 18, 2014
I have a query that is based on Property & tenants. It runs a report that gives me all the property listed with the tenants & other info for the property's. Sometimes the tenant moves out & the property is Vacant, so i have a Vacant flag in the property table.
But when i run the query it prints out the last tenant. Can i pick up the vacant flag & change the tenant name to Vacant on the report? As i don't want to delete the tenant from the tenant table.
View 3 Replies
View Related
Aug 8, 2014
I have a table of events, tblActivitiesDates which have an activity type and a date.I have a form which has a datasheet with a query source (a separate datasheet form embedded in this one), and 2 radio buttons. The query that is used uses radio buttons this way:
-Activity Type Filter: A radio button, that when clicked a combo box appears, with a list of activity types to choose from. Basically, filtering by Activity Type.
-Date Type Filter: A radio button, that when clicked 2 text boxes appear, in which you write the dates between which you want to see the events organized in the table. Basically filtering by dates.
To make reading easier, Activity Type Filter=ATF, Data Type Filter=DTF.There are 4 possible options:
-ATF=ON and DTF=ON
-ATF=ON and DTF=OFF
-ATF=OFF and DTF=ON
-ATF=OFF and DTF=OFF.
For each option, I have written a line of code in the appropriate OnChange/AfterUpdate/Whatnot events in the form: CurrentDb. QueryDef ("qry ActivitiesDates"). SQL = "SELECT..."according to whatever option is currently active.
When I enter values into the form, and instead of embedding my datasheet form I simply open it every time from the navigation pane in a new window, the datasheet is filled appropriately and works 100%. Of course, I have to reopen it every time I change something so the query will rerun.After the table crashes (will be explained soon), I re-embed it to the form before trying it again. The first time I re-embed, no matter what I do, the query doesn't update nor crash.
Say I start with the option ATF=ON, DTF=OFF, it will work fine, updating when needed, but if I tick DTF=ON, regardless of the dates I enter, the table will only change according to the first option (While when open in a new window will show the correct table entries), ignoring the fact that the QueryDef. Sql has changed. Once I tick ATF=OFF, the table crashes and I get the error:"Run-time error'3420': Object invalid or no longer set".The exact same thing happens when I go DTF=ON,ATF=OFF. It ignores the event types I enter, and once I tick DTF=OFF, it crashes with the exact same error.
I added Me.Activities_DS.Form.Requery (datasheet's name is Activities_DS) in every place it should update.
View 8 Replies
View Related