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.
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.
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.
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.
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")
I made this code in excel, and I'd want to get it working in access.
Sub Satunnaisluvut() Dim OmaAlue As Range Dim Solu As Range Set OmaAlue = Range("A1:A5") For Each Solu In OmaAlue If Solu.Value = "aa" Then Solu.Value = "bb" End If Next Solu End Sub
How do i set the wanted field? And how about the loop?
I have set up a database that stores actions (i.e jobs). In the table; two of the fields are...'required completion date' and 'actual completion date'. I wish to lookup, by using a query, all of the open actions (those which havent yet been complete (i.e the 'actual completion date' is null)) and then later on all those which are overdue (i.e the 'actual completion date' is null And the 'required completion date' <today....this being the criteria for an overdue action).
However, I have used a form which has a combo box which contains the values open and overdue. When a selection has been made I want a form to display with the results depending on the selection that has been made. I am capable of creating a form based on a query, but am unsure of how to construct the query with the correct criteria based on the option that is selected from the form.
I have data for hundreds of stores. The data was pulled for the top 15 items by store, so I cannot obtain only the top 5 items that I need. How can I query this data to extract only the top (or bottom) 5 Subjects, by store, based on the percentage column?
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?
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?
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!
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
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 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.
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.
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]));
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?
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.
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.
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)
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?
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.
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#;
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
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?