I have an append query which runs from a command button. It transfers all the fields I want it to but when I run the query when in one particular record it not only appends the field for the current record but appends the fields for every other record in my table. I know I should be running the query using stLinkCriteria but I'm not sure on the syntax for the code, see below:
Hi, In the example attached below how can I see the "cut off date" that I am prompt to enter in the fourth field of query1-a (I would like to see it for each one of the record that are displayed when the query is run and then append it to a table) Cheers,
I would like to run an append query but only after I have checked a table for existing data. I want to see if a ralicarID exists in a table and if it doesnt the query should run. if the railcarid does exist but also has a check in and check out date then the query can also run.
I was thinking something like this
Dim RailcarInDatabase as number ' run query here that checks for the railcar id and returns a value if railcarID in table then RailcarInDatabase =1 else RailcarInDatabase =0
And if If RailcarID in table and DateInShop is not null and DateOutShop is not null then RailcarInShop = 0
Something like that which will allow me to run the query only if the car is not in the database or it is currently not in the shop.
I have an append query that contains a parameter [PTIdent] under the field named PTID. I would like to be able to set the parameter through VBA from a control on a form eg Form!PTID
I use the following code as normal Private Sub Command19_Click() On Error GoTo Err_Command19_Click
Is there a way within this code to do this? I realise I could set the form criteria within the query itself. However I wanted to be able to use this query from multiple forms.
I have a table of values in a table called UpdateTable. Before i do the update though i want to copy the entire record for archive purposes. I would like to know how to create an append query that uses another query as the criteria. ie;
UpdateTable - holds current values to be used to update MainTable MainTable - holds all the data ArchiveTable- a copy of the entire record that was updated even if only one value was updated
I would like to know how to use a query as the criteria for an update query so I can get a list of all CarIDNumbers in the UpdateTable and use that as the criteria for which records in the MainTable I want to append a copy to in the ArchiveTable.
Basically I need all the CarIDNumbers in the UpdateTable because each time I want to append a copy of all of the records and after each process I will delete all the records in the UpdateTable.
Hi I have created 4 tables which have 3 field common in all these tables and carry the same data value. Is it possible to enter data in the first tables and it copies to other tables automatically. After all its the same 4 data fields in these tables. Liver database Table 1. Auto ID; Surname, First name, Patient ID;-----other not common fields. Table 2. Auto ID; Surname, First name, Patients ID;----other not common fields.
I have cboUtilizator (User) for choosing username, txtp for password input and a text box called lngEmpID wich Control Source =[cboUtilizator]. The user select his username, enter his password then when he click the OK command button the code verify if the password is correct for selected user, and if it's correct based on lngEmpID, opens a ChangePassword form showing the user data. This way he can change only his password, 'cause this is the only information he can access. The problem is: If I put this code
Dim stDocName As String Dim stLinkCriteria As String stDocName = "ChangePass" stLinkCriteria = "[lngEmpID]=" & Me![lngEmpID] DoCmd.OpenForm stDocName, , , stLinkCriteria
to a command button, it's OK. But if I insert it in the code, the way showed bellow, it isn't working anymore, on the line
stLinkCriteria = "[lngEmpID]=" & Me![lngEmpID]
it give me the following error message: "Run-time error '2467' The expression you entered referes to an object that is closed or doesn't exist."
Can anybody help me to fix this?
Thanx, Attila
Private Sub Command5_Click()
'Check to see if data is entered into the UserName (cboUtilizator) combo box
If IsNull(Me.cboUtilizator) Or Me.cboUtilizator = "" Then MsgBox "Va rugam introduceti numele de utilizator.", vbOKOnly, "Completare obligatorie" Me.cboUtilizator.SetFocus Exit Sub End If
'Check to see if data is entered into the password box (txtp)
If IsNull(Me.txtp) Or Me.txtp = "" Then MsgBox "Va rugam introduceti parola.", vbOKOnly, "Completare obligatorie" Me.txtp.SetFocus Exit Sub End If
'Check value of password in table users (Utilizatori) to see if this matches value chosen in combo box
If Me.txtp.Value = DLookup("Parola", "Utilizatori", "[lngEmpID]=" & Me.cboUtilizator.Value) Then If DLookup("TipUtilizator", "Utilizatori", "[lngEmpID]=" & Me.cboUtilizator.Value) = "Admin" Then lngMyEmpID = Me.cboUtilizator.Value
Dim stDocName As String Dim stLinkCriteria As String stDocName = "ChangePass" stLinkCriteria = "[lngEmpID]=" & Me![lngEmpID] DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
Dim stDocName4 As String Dim stLinkCriteria1 As String stDocName4 = "ErrLog" DoCmd.OpenForm stDocName4, , , stLinkCriteria1 Me.txtp.SetFocus End If End If
:mad: and tearing out my hair with this one... Someone out there please help:
I have a form that should open, linking to the date on another form (that is changeable using a Calendar Control), and display records for that date.
My underlying data is available for a variety of dates but some of the dates (and therefore the records) will not appear when this form opens.
They will all show if the form is opened without the filter. Or they will show in a report. So I know that the coding is correct. This intermittent-type thing is really bugging me.
Have even tried re-typing some of the dates in the table in case the format has somhow got changed.
I have a table that I want to append to another table, but I do not want to duplicate records if the check number is already in the table I am appending to. I have tried <>[deposit].[check_number] or not like [deposit].[check_number] or not [deposit].[check_number] but I always get prompted to enter a check number... therefore the criteria statement not working. do not know what I am doing wrong.
Private Sub btncard_Click() Dim stLinkCriteria As String DoCmd.RunCommand acCmdSaveRecord stLinkCriteria = "[jobref]=" & "'" & Me![jobref] & "'" DoCmd.Close DoCmd.OpenForm "k_job_card", , , stLinkCriteria End Sub
this button code opens the k_job_card form.
the form opens and says 'Record 1 of 1, (Filtered)
i have a control on the form that opens.. and i am simply trying to assign a default value to that control..
it is a textbox.. for my jobtype field (text datatype)..
is there any particular reason why i cannot assign a default value to a control if it has been placed on a form that has been opened using a form filter?
this is how the Form Data tab is set at the moment..
hi Guys, I have been looking at different post and checking Microsoft help files as well, but still can't seem to fix this problem.
I am having 2 tables. The first table is connected to a form for viewing and entering data, and in the second table i am just copying 3-4 fields from the first table.
I am trying to use the insert statement to insert records in the second table, and everytime i click on the "Add" button to add the records i get the following error "MS access can't append all the records in the append query ... blah blah blah"
However if i close the form and reopen it, and goto the record (as it is saved in the first database) and now click on the add button to add the fields to the second table/database, it works.
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 some cases I create pass-through queries and use these in an Append or Make-table query to bring data locally.
All is well and fine until source data changes and the pass-through query runs too long and times out.
If needed, I can extend the timeout value in the Parameters of the pass-through query no problem, but when I try to open the Append or Make-table query in Design view to do the same, the pass-through query is first triggered and then throws the timeout, and I cannot access the Design view of the Append or Make-table
Is there a way to open an Append or Make-table query in Design view without invoking the source query?
Please would someone be able to advise me how I could link an Access Query to an Excel spreadsheet. Also, is it possible for the Excel spreadsheet to be 'updated' automatically when the data in the Access Query is updated ?
I'm quit new to Access. I have an existing application. There is a form with some selection fields. When I press the button report then following is executed: - The report object is called with DoCmd.OpenReport Rpt, acPreview - This report has object dependencies with the query qryRptClient AND the form frmClient. This is the form with the selectia criteria.
The query "qryRptClient" has nested query's but in some of them, in the where clause fields are tested like: "WHERE (tblTempProject.country=forms!frmClientReq!cmbCoun try"
Generating of the report works correct ==> so far so good.!
Now the application must be extended by exporting this report result to XML file. So I have added on the form another button wich is calling the same query Like:
But now I get for every selection criteria field which is used in the query's a popup window asking what the value is of this form object.
So, I understand with the report that there is a link between the report, query and the form but in the second occassion how do I get a link between the query and the form.
Can somebody help me? Thanks in advance.
Nico.
P.s. When I try this with northwind database, with the query invoices, it working correct and I get a XML file! So the export on itself is working.
I am working on creating a query to base a form on. I've done it several times in this database, but today, for some reason I cannot figure out how to do it.how I did it before but it looks like the SQL statement got wonky:
Code:
SELECT tblEmpInfo.EmpInfoID, tblEmpInfo.EmpIDFK, tblEmpInfo.JobNumberFK, tblEmpInfo.EmpType AS Expr1, tblEmpInfo.CraftCode AS Expr2, tblJobs.JobSite FROM tblJobs INNER JOIN tblEmpInfo ON tblJobs.JobNum = tblEmpInfo.JobNumberFK;
Basically I have a look up table and all I'm doing is making it so I don't see the Cert ID it just pops up with the description.
Basically what I am trying to do is to link the crosstab query to a Form. the crosstab query has the following SQL:
TRANSFORM Sum(SubQryTotalProductSales.SumOfQtyOrdered) AS SumOfSumOfQtyOrdered SELECT SubQryTotalProductSales.fkProductID, SubQryTotalProductSales.ProductName FROM SubQryTotalProductSales GROUP BY SubQryTotalProductSales.fkProductID, SubQryTotalProductSales.ProductName, SubQryTotalProductSales.YrOrder ORDER BY SubQryTotalProductSales.YrOrder DESC PIVOT SubQryTotalProductSales.YrOrder In ("2015","2014","2013","2012");
The Main form was made from my Product table and contains all the product related fields. ProductID, ProductName, Description, X_Ref, ListPrice, OurCost, fkSupplier, Discontinued, ReorderLevel etc....
Then I made a Subform with the crosstab query, and tried to place it in the main form. So far everything seemed to work. The next thing was to make the Child and Master Link, I used the fkProductID from Child (Subform), and the ProductID from Master. So there are no errors, but I don't get the link to work, that is when I change the product Field in the Master the Subform does not change accordingly.
When I change the view to design view and then change again to Form view, it opens up with the correct product in both Master and sub. Except in the Sub the productName Shows the productID instead of product Name.
I am referencing a table output in excel and when I go into Access to see where the table is pulling data from I get stuck. I go into the table in design view but where the table is getting its data from. I need to know which queries it is getting its data.
I'm trying to separate LastName, FirstName into separate fields : FirstName and LastName. The code I have is working for the most part. But I had to create a separate query with the replace statement to get rid of the ","... Looking at the data now, I had people with names like Mac Buren, Tony and I'm only picking up the Mac part in my query.
Code: SELECT Left([Employee Name],InStr([Employee Name]," ")) AS qryLastName, Right([Employee Name],Len([Employee Name])-InStrRev([Employee Name]," ")) AS [First Name], Employees.* FROM Employees ORDER BY Left([Employee Name],InStr([Employee Name]," "));
I want to 'append' individual records from 2 tables and place in an archive table or within another database, whichever is the best option. I then want to be able to 'delete' the relevant records from one table.
The tables are tproperty and trents. This property paid rents but has since been sold. Therefore it no longer belongs in the database, however client wishes to keep details of the property/person/and rents paid in past, for any future ref. These tables are linked in relationships to tlessee and tbilling. I've read books/notes/looked on here for inspiration and the right direction! If I choose 'append' which seems pretty straight forward then a 'delete' query, how do I choose only one record? Is a make-table onto a different database a better option? It would appear that the whole table is copied over? Can't understand the issue about auto-numbers being copied over? Do I have to use an append/delete query for each individual property that's ever removed? I'm at a loss! :) Thanks
I have a database that contain foreclosure records. I'd like to create a query that will ask for a date and all records that are LESS than the date will be moved to a different table.
I'd also created an icon on my form and I'd like to attach this query to it.
Please how can i use a procedure to create a query, then append the content of the query to a table (am using MS Access Project)? i did it in Microsoft acess database but now i need it on Microsoft access Project beacuase am transfering to SQL server. Thanks