Changing The Name Of A Query From A Form
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 Replies
ADVERTISEMENT
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
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
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
Apr 20, 2006
I just recieved a call from a customer who is having trouble with a database that I did not create for her.
She says that she modified a form in design view and saved it. Now when the database is opened using he shift key, the changes show on the form in form view. She says if she opens the database normally (without the shift key) the changes do not show on the form.
This does not make sense to me. Can anyone give me a clue as to what might be going on?
View 5 Replies
View Related
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 1 Replies
View Related
Dec 29, 2005
Is it possible to change which subform is displayed by pressing a button, on the same form?
Each subform is based on a parameter query if that has relavence.
View 10 Replies
View Related
Jun 26, 2006
I have a form (frmInfo) that I would like to use for 3 purposes.
1 - to enter to information (data entry mode)
2 - to view existinging information (for a single record)
3 - to edit existing information (for a single record)
There is a Main Menu that allows the user to choose, Enter New, View or Edit.
If they choose NEW: the form (frmInfo) will open for data entry
If they choose Edit or View, a form (frmSearch) with a listing of all jobs will open, the user then chooses which job to Edit or View...from here frmInfo is opened to display only the record chosen and the record will be editable or read-only depending on the choice from the Main form.
At what point should the frmInfo recordsource be defined?
View 1 Replies
View Related
Jun 30, 2006
I have a property form for keeping track of houses and buildings owned and then on that form i have a policy field for the policy number of the insurance called txtPolicy. Next to that field I have a little button which opens a form so it will show all the insurance policies associated with the housing group which the property is in. When i select the appropriate policy and double click it in the listbox I want it to close the form and set the value of the txtPolicy to the one just selected in the listbox. I know how to get the value of the item selected in the listbox but I just don't know how to set the value of a field on another form...
View 1 Replies
View Related
Dec 5, 2006
I have a Main form with a number of tabbed subforms. I want the main form to show a list of records entered that the user can scroll through. When I change it to continuous forms it give a message saying it cant be changed as it contains a subform, an activex control or a bound chart. The main form is linked to the tabbed subforms to allow the user to see full detail of the records associated with the main form.
View 1 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
Jun 9, 2005
I have a form which uses a query for entry to the table. One of the fields in the query is a calculated field which shows in the form. The calculated field returns a number from 1 to 5. Rather than showing this number I would like to show a round stoplight that changes color for each number. I have inserted a OLE object OLEunbound235 into the form. The colors I want to use are
icolor = RGB(255, 204, 0) 'Gold
icolor = RGB(192, 192, 192) 'Silver
icolor = RGB(216, 129, 0) 'Bronze
icolor = RGB(255, 255, 0) 'Yellow
icolor = RGB(255, 0, 0) 'Red
and icolor = RGB(255, 255, 255) 'White for any other value.
The text box that returns the calculated number is labeled Text1 and I have hidden this box so it can not be seen. Does anyone know how to write this code that would change the OLE object color automatically so when the user enters data into the form and the return number changes the color of the OLE object changes. I know very little about VBA and I am not sure where to begin or where to even write the code.
:confused:
View 2 Replies
View Related
Feb 8, 2005
Hi all,
I have Form F_CashSalesHead with a subform F_CashSalesInvFoot with one-2-many relationship on their tables. Subform contains a checkbox field that I use to lock the record set (On a command button click it runs one update query to add value 1 to each checkbox to make Enable=False all the records of current invoice on the form).
One-2-many relation ship is made on InvNum field in both tables.
When I open F_CashSalesHead form, bcz of some code line I wrote on On Load event of F_CashSalesHead , at the beginning it give massage how many invoices are pending to lock and would you like to see. If click “Yes” to see list, it opens a small form that called F_Count_Unlocked_Invoices showing invoice numbers and unmarked checkbox which is pending to lock. This small form is based on following query,
SELECT DISTINCTROW T_CashSalesInvFoot.InvNum, T_CashSalesInvFoot.CashSalesCustomerName, Sum(T_CashSalesInvFoot.Lock_Cash_Inv) AS [Sum Of Lock_Cash_Inv]
FROM T_CashSalesInvFoot
GROUP BY T_CashSalesInvFoot.InvNum, T_CashSalesInvFoot.CashSalesCustomerName
HAVING (((Sum(T_CashSalesInvFoot.Lock_Cash_Inv))=0));
This works fine.
What I am looking for is, I want to use the same F_Count_Unlocked_Invoices form for Credit Sales invoice also with the same trick. Because I don’t want to create another same form and write code that help to increase size of db.
Can it be done just by changing record source of form F_Count_Unlocked_Invoices? Or what is the way to do it?
With kind regards,
Ashfaque
View 2 Replies
View Related
Apr 5, 2005
Hi,
I have design a form using the tab control. I need to add in color to make it more professional. Is there a way I can do it. I realised the filled /Back color icon is faded in color in design view.
Appreciate any help in this. Thanks.
View 2 Replies
View Related
Dec 11, 2005
Hello...
I am a newbie to Access or any database for that matter. So please be gentle.
I'm in the process of writing an automotive invoicing database and have gotten stuck early in the game.
On my form I have Qty1 - Mat1 - and Amt1 fields placed from my database.
In Amt1 I would like to typein an amount and have it multiplied by 15% (.015).
I fiddled with the "On Enter" in the Amt1 property box but got nowhere.
Can someone help???
Thanks for your time
d9085@hotmail.com
View 7 Replies
View Related
Dec 14, 2005
I have made attempts at this but none have worked, so I am looking for guidence.
What I creating is a database that I can track students and their community service hours.
I have made several versions but I figured the experts could point me in the right direction.
So far I created two tables:
tblStudents
STUDENT_NAME - Text
HOURS_GIVEN - Long Integer
tblHours
STUDENT_NAME - text Links to tblStudent
DATE_COMPLETED - Date
HOURS_COMPLETED - Long Integer
I created a form "frmStudent" with the following:
a drop box to chose a student name from "tblStudent"
a text box "txtSTUDENT_NAME"
another text box "txtHOURS_GIVEN"
another text box "HOURS_REMAINING"
Then I have a subform that has two text boxes "txtDATE_COMPLETED and "txtHOURS_COMPLETED"
I need a code that will enable me to chose a student from the combo box and then have that students name and hours given automatically enter into the respective text boxes in the main form. Then I would enter the date and hours completed into the respective text boxes of the subform, which in turn would update the fields in "tblHours" at the same time subtracting the new hours from the hours given and displaying the new total hours remaining in the respective in "txtHOURS_REMAINING" of the main form. Can anyone give me any help in coding that? Thanks in advance.
View 2 Replies
View Related
Sep 3, 2004
I am having a problem with my form. When it opens up, it is maximized, which is what I want. However, the vertical scroll bar on the right does not begin at the top of the form, but towards the bottom. I have to scroll up each time so that I can see the top of my form. Is there a way to make the form startup at the top of the form?
View 1 Replies
View Related
Sep 8, 2004
My scenario is that a user enters how many parts of 'Part No.' are going in or out of Inventory. I also would like fields automatically entered on other tables based on the data the user enters. All I need is some understanding of how to code something like this or a pointing in the direction of a resource that can tell me how to code this VBA stuff and the syntax required.
Hopefully you get what I mean.
Thanks.
View 3 Replies
View Related
Sep 3, 2004
Is there any way to change the color of a field based on the value of a field.
I know how to do this for a single form but I need to do it for a Continuous Form
(each line may be a different value and have a different color.)
Is there some event that happens before each line displays???
Thanks
View 4 Replies
View Related
Aug 8, 2007
I have the need to put a company logo on a form based on the company selected from a combobox on the form. I have a table which has one field for company name and another field containing the picture object. The form itself is bound to a different table where I want to company selected from the combobox to be recorded. I want to make the form capable of displaying the logo (bound ole object?) based on the company selected from the combobox.
I think I am close, but I do not know the proper method for doing this.
View 4 Replies
View Related
Feb 26, 2014
I'm making a form for colleagues to use which will eventually populate a table. I'm using DLookup to populate some of the fields in the form from another table. The problem is that for a few of the fields in that other table, the values are incorrect.
(Obviously the most sensible thing to do would be to amend the source data but for various reasons I cannot do that.)
For example, "date built" in the original table might be "f" but that needs to be changed to "h", so I tried the following but it doesn't work:
.................................................. ............................................
If DLookup("date_built", "dbo_meas_questionnaire", "[meas_id] = Forms!FrmRetestSearch.numOrigId") = "f" Then
Me.TxtDateBuilt = "h"
Else
Me.TxtDateBuilt = DLookup("date_built", "dbo_meas_questionnaire", "[meas_id] = Forms!FrmRetestSearch.numOrigId")
End If
.................................................. ..................................................
View 4 Replies
View Related
Jul 29, 2013
how am I suppose to change the form name in the forms in VBA access, now see I would not want to change the names by using the coding.
Please note that I have got so many forms, however I have worked with the default names to start some of them would be, form1, form2 Now, when I am trying to follow the best practice approch, by changing the form name by right clicking and hitting rename, I am unable do so as it is popping up and giving me a statement as below.
"The form name 'Form2' is missspelled or refers to a form that does not exist" and continued in the next line as below
"if the invalid form name is in macro, an Action failed dialog box will display the macro name and the macro's arguments after you click OK. Open the Macro window, and either the correct name."
View 2 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
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
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