But I don't know what to put for an expression. I would like to use the same form but base the RecordSource on a query called "Receiving Search by Date". :eek:
I want to write Visual Basic language in the form with one button:
I have one form named "setForm" with one button and one text box: Let's set the new table "frm2", the new form "frm2"
Dim sql As String sql = "SELECT [model].* INTO frm2 FROM [model]" CurrentDb.Execute sql DoCmd.CopyObject CurrentDb.Name, "frm2", acForm, "frm1" Forms!frm2.RecordSource = "frm2"
The last statement code doesn't work: It is said that Microsoft Access cannot find the form "frm2" referred to in a macro expression or visual basic code.
I have a report that can be used for 3 different queries. I've been trying for the last hour or so to get three different buttons on a form to open this report but give it an appropriate record source. I figured there's got to be a way that's easier than three queries, and three reports...? I was trying to use the same format as with forms : [Reports]![rptReportName].recordsource = "qryQueryName"
or variations of that. Am I way off? It keeps saying that I've misspelled the name or it doesn't exist.
I have been helped out so many times in the past here I thought I would try my luck again.
Is it possible with the use of option buttons to change the row source of a listbox? I want to use the listbox for a search criteria and thought it might be easier to have 1 listbox been updated from the choices made using a group of buttons. I would like like the row source to be based on different tables maybe I might need to use queries.
How do i make my subfrm record source switch to another saved query (qryPendingStatus) when it's opened from the form.
Heres what i am trying to accomplish: I have a subfrm that i'd like to use to display info in 2 different forms.
There's a form currently for All statuses. Then another new one for Pending status. I'd like to use the same subform for this pending status form also, and in doing that my qryAllStatuses, but change to qryPendingStatus on the subfrm when i open the mainfrom.
This is on the open even ofthe mainform, but does not work (says method not founds...so obviouly i can't use ".Recordsource" here: Private Sub Form_Open(Cancel As Integer) Me.subfrmJobInfo.RecordSource = "qryPendingStatus" End Sub
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.
I'm making a db that will import a spreadsheet from Excel, then separate it into 3 different tables using queries, but then I need to put all the 3 different tables together one after the other. The problem is that the 3rd column on each table have different names on each table, so I can't append the tables together.
So, how can I use a Macro or something to change the column name on all 3 different tables so that they match and can all get appended together.
I have a subform within a form that displays filtered data based on dynamic selection criteria which is assigned to the RecordSource/OrderBy of the subform. On this form, I have a "Print Results" button -- OnClick, I would like the RecordSource/OrderBy of the subform to be copied to the Report, then run the report. What I have that doesn't work is:
I have a query that I am using as recordsource for a form. I also have a list box that I am using to change records on the form.
My issue is I need to use the same form for similar queries. For example, I want to open the form with only "Manager1" records displayed. So I need to do a different query. I don't want to use parameters or have employees type the manager in. It needs to be just a button they click.
So my two options are - make 10 copies of the form each with their own new query recordsource for each manager, or use one form and dynamically input the recordsource before the form opens..
I want to do that -- but when I try the list box gets all screwed up. Because the list box is relying on another SELECT query to populate. I have 10 buttons each with a different recordsource query feeding into the form when I click but I get so many errors in the fields when the form opens.
I currently have a Job Management System where the Customer Order Form displays all jobs via a main form and an order details subform. This form is used for inputting new jobs and for viewing existing jobs via links from other reports such as a job schedule or customer orders report. It is always reached via a clicking of a "New Customer Order" Button where the form is filtered to new record or via double clicking on an order number in another screen and filtered via the order number.
I am now in a position where the database is growing too large and I want to archive the data in the Orders / OrderDetails Tables into Financial Years and put them in a separate backend database. However the jobs will still need to be viewed via the customer order form in order for them to be duplicated the following year.
I have created a union query of the PreviousFY and Current Orders to allow the "search jobs by customer" query to work. This works fine, but I now need to make the record source of the Customer Order form dynamic.
I have created a CurrentFY query to feed the form if it is a current job and a PrevFY query if it's from the previous FY.
I have written code to check the OrderDate against the financial year to work out which database the job is from and set recordsource according to that result. This is currently in the OnCurrent event as I also have other code there that checks details of the order to determine if fields should be editable.
However I am finding that when I parse the order data between the forms the "new record" command or the order number is not being retained or checked. If this because I don't have a recordsource set when it opens?
I tried setting the recordsource as the currentFY on open and then do the check but that didn't work.
I've got a DB, which has 3 forms ( all 'under' 3 navigation buttons/tabs ). The main form ( Client's form ) is set to show first, and currently has a recordsource of about 1350 records. I think the size of the recordsource, and the fact it 'loads' the other two forms all 'in one go', is slowing it down ( between 5 and 10 secs. to load ).
I read I should set the Visible properties of forms, not shown immediately, to false, only setting them to True in the On_Load event - when Tab is selected. Ideal I thought. However, I can't find this property in the Form's property sheet.
In Access 2010, I'm writing VBA code that assigns an ADO dataset as the recordsource for a form. The query itself varies and is constructed from a search term typed in a textbox by the user. The code below works perfectly until the dataset is empty, when no records satisfied the WHERE criteria. In that case, there is a very long pause (presumably a timeout?) and I eventually get the error message "ODBC call failed." I tried to get around this by testing the number of records in the dataset (see toward the end) before assigning it, but it makes no difference in the behavior, so I'm thinking the actual assignment isn't the issue ... something else is.
If it matters, the "FROM qry_beneficial_owners" in this case is predefined query local to my Access db. That query is based on a linked view from a SQL server.
Code: Public Sub RunSearch(SearchTerm As String) Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim sql As String Dim cols As String cols = "[acct], [acctname], [planid]"
I have a simple add form that will add an entry to one of two tables: Box 1-1, or Box 1-2.
They have the exact same fields. In the add form, I want the user to specify a Rack field and a Box field. Box 1-1 would be Rack 1, Box 1. Box 1-2 would be Rack 1, Box 2 (there will be more tables later, but just using two for now until I get it working).
But right now my form always adds to the table Box 1-1 - I can't get it to switch.
I've added the code I have so far below. The first part is what I'm having trouble with, the second part just uses a Submit button to add a new record - I'm just including it in case it's interfering in some way I'm not seeing. I'm running Access 2007.
Code: Private Sub Switch_BeforeUpdate() If Me.Rack.Value = "1" And Me.Box.Value = "1" Then Form_Add.RecordSource = "Box 1-1" ElseIf Me.Rack.Value = "1" And Me.Box.Value = "2" Then Form_Add.RecordSource = "Box 1-2"
I would like to populate form fields with records from a table/query so that they are bound to the recordsource and the record to be displayed can be selected from a combobox. I am hoping that in this way, any changes made are propagated to the original table.
I have created a combobox from which the primary key can be selected and added all the fields from the table appearing on this form as values.
In my Change event for the combobox I have this code:
Private Sub cboID_Change() Me.RecordSource = "SELECT b01_Participants.*FROM b01_Participants WHERE (((b01_Participants.ParticipantID)= " & cboID.Column(1) & "));" Me.Refresh End Sub
However, I receive an 3075 error when this code runs which seems to relate to my syntax or an extra ")".
I have a form with a (large) number of controls which acts as a kind of read-only dashboard of data. The data is split across a number of tables (4, for now, but may grow) I've created a query which amalgamates all of the data from the tables into a single dataset and set that as the RecordSource (Snapshot) of the form. I now want to bind each of the controls to a particular field returned by that query.
However - I have a combobox (same form) which allows users to select a date and I need the controls to update with the relevant data for that date whenever the combobox is changed. The query already returns values for each field over a range of dates so the data is available within the form's RecordSource - I just don't know how to include the date criteria, as specified by the combobox, when binding each individual control?
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"
I have not done much work in later version of Access. Now I found if I change a design in one form and similar forms (names are different) which are linked to the same tables got changed as well without openning them up and making changes. Is this something new with Access 2003?
I have a macro written that when clicked on it opens a web browser. Is there a way this can then point to a specific website url? I could make the default url in the browser point to a url but each time i click on the macro button the url needs to be different. all of the urls sit in a table within the database.
I have got a small question about the "set value" macro. I am trying to use this macro in a form, so that the user doesnt have to type or lookup that value.
So what I want is a macro, that copies a value from a controlfield of a form and inserts this into another form and new record.
What i have is a inventory list of books. Some writers have written more than one book, so I created forms for <Add new book to existing writer>. But until now it doesnt work. Maybe somebody has a better idea.
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
Right to the problem, I have a macro that load a form this works fine, but the problem is that i need the form to show on a subform using a case function i have included a copy of the file for some kind person to look at for me.
I need the table file to be the same as this one. This has been giving me sleepless nights tring different methods.
Hi All Can someone help me with opening a form from another form using the OnDblClick event and to open the form using the data in the record to open it at the same record. ie Site Name = CP House so the form opens with CP House data showing, Site Name = St James so the form opens with St James data showing etc. Thanks ChrisD