I have a table in my database which I want to update on a daily basis from an Excel workbook. Normally I would just use the TransferSpreadsheet command but in this case the format of the source sheet makes things a bit more complicated (It's not my workbook so I have no control over its layout, unfortunately)
My formatting issues are as follows :
-the header row is not on row 1, but row 3 (the first two rows are free format comments) -there is a gap row between the header and the data region -the source sheet is laid out with dates as the headers (left to right) and my field headers running down (top to bottom) - so would need some form of transposition -Basically, looking for some direction on how I should approach this while maximising efficiency. One approach would be to have my own local Excel sheet with VBA code added, to open the source sheet, copy / edit / transpose as necessary and then import my local version and append to the existing table. But this adds an extra step to the process which I'd like to avoid if at all possible.
I would prefer to 'customise' the import within Access itself, to account for the above obstacles, so that I could just point to the source document directly but import according to my own 'non-standard' rules.
Hello first of all I have learned a lot from this forum so thanks you all who post questions & solutions. Ok I have a table which I use to query info and export to excel. My question is there a way to add sum totals to a few of the columns once it is in excel. I was thinking it would be easier to do a sum statement then just add it as the bottom row while it was exporting. Or would it be easier to do it once it is in excel. Here is my code:
Private Sub Command63_Click()
Dim strSQL As String, strOrder As String, strWhere As String Dim dbNm As Database Dim qryDef As QueryDef Set dbNm = CurrentDb()
If Not IsNull(Me.txtCSONME) Then strWhere = strWhere & " (tblCONSOLIDATED.COMPANY_NAME) Like '*" & Me.txtCSONME & "*' AND" End If
If Not IsNull(Me.txtCSOSLD) Then strWhere = strWhere & " (tblCONSOLIDATED.ACCOUNT1) Like '*" & Me.txtCSOSLD & "*' AND" End If
If Not IsNull(Me.txtCSOARN) Then strWhere = strWhere & " (tblCONSOLIDATED.CONTACT_NAME) Like '*" & Me.txtCSOARN & "*' AND" End If
If Not IsNull(Me.txtCSOCTY) Then strWhere = strWhere & " (tblCONSOLIDATED.CITY) Like '*" & Me.txtCSOCTY & "*' AND" End If
If Not IsNull(Me.txtCSOST) Then strWhere = strWhere & " (tblCONSOLIDATED.STATE) Like '*" & Me.txtCSOST & "*' AND" End If
If Not IsNull(Me.txtCSOZIP) Then strWhere = strWhere & " (tblCONSOLIDATED.ZIP) Like '*" & Me.txtCSOZIP & "*' AND" End If
If Not IsNull(Me.txtCSOSSM) Then strWhere = strWhere & " (tblCONSOLIDATED.REP_NUMBER) Like '*" & Me.txtCSOSSM & "*' AND" End If
If Not IsNull(Me.txtCSOM1) Then strWhere = strWhere & " (tblCONSOLIDATED.PROMOCODE) Like '*" & Me.txtCSOM1 & "*' AND" End If
If Not IsNull(Me.txtSLCYYD1) Then strWhere = strWhere & " (tblCONSOLIDATED.CURRENT_YTD) BETWEEN " & Me.txtSLCYYD1 & " And " & Me.txtSLCYYD2 & " AND" End If
If Not IsNull(Me.txtSLLYYD1) Then strWhere = strWhere & " (tblCONSOLIDATED.PRIOR_YTD) BETWEEN " & Me.txtSLLYYD1 & " And " & Me.txtSLLYYD2 & " AND" End If
If Not IsNull(Me.txtSLPYR11) Then strWhere = strWhere & " (tblCONSOLIDATED.PRIOR_TOTAL) BETWEEN " & Me.txtSLPYR11 & " And " & Me.txtSLPYR12 & " AND" End If
If Not IsNull(Me.txtSLPYR21) Then strWhere = strWhere & " (tblCONSOLIDATED.YEAR2_TOTAL) BETWEEN " & Me.txtSLPYR21 & " And " & Me.txtSLPYR22 & " AND" End If
If Not IsNull(Me.txtSLPYR31) Then strWhere = strWhere & " (tblCONSOLIDATED.YEAR3_TOTAL) BETWEEN " & Me.txtSLPYR31 & " And " & Me.txtSLPYR32 & " AND" End If
If Not IsNull(Me.txtSLPYR41) Then strWhere = strWhere & " (tblCONSOLIDATED.YEAR4_TOTAL) BETWEEN " & Me.txtSLPYR41 & " And " & Me.txtSLPYR42 & " AND" End If
If (Me.PROSPECTBX) = True Then strWhere = strWhere & " (tblCONSOLIDATED.CUSTOMER_TYPE) Like 'P' AND" End If
If Not IsNull(Me.txtSLCLS) Then strWhere = strWhere & " (tblCONSOLIDATED.SALESCODE) Like '*" & Me.txtSLCLS & "*' AND" End If
If strWhere = "WHERE" Then strWhere = "" Else strWhere = Trim(Left(strWhere, Len(strWhere) - Len("AND"))) End If
how i can calculate totals after i export some data from access to excel (using CopyFromRecordset). I'd like to put the total the row after the last row of data similar to how one use to AutoSum in excel.
I have a combo box named Session which comprises of am and pm. I have a number of fields that relate to this combo box.
E.G. Monday am Sales £1000 Monday pm Sales £ 2000
I want to create a total Sales of the am and pm to derive a total of £3000.i.e. Monday Sales is £3000 which is a combination of the am and pm sessions.
I'm trying to create a query to work out the total amount to invoice based upon some selections. Currently my query looks at the values in several fields (numberOfRollsUsed etc) by taking the value in these fields and multiplying by a fixed amount to calculate the total.
What I would like to add to the query is fixed values based upon some check box selections. So if check box A is selected, add 5 to the total, is check box B is selected, add a further 10, and so on. All fields and check boxes are held within the same table (Job).
Am I being daft or trying to do something in the worst way possible? I'm actually adding this to an existing system so I don't have so many options to completely redesign the system to calculate this in a better way.
Hello, this is my first post. I am very much a novice and have come across a problem that I'm sure is simple to solve but so far the solution has eluded me. All I want to do is subtract a field in one record from the same field in the next record in a query or report but I have no idea how to do it. Can anyone help please ?Thanks in advance.
I am having a problem in my one form where I have to click on the "go to next record arrow" twice before it displays the next record. (even on the "create new record" it requires 2 clicks)
All other forms I have display the next record for only a single click on the arrow.
Is there something unique in the properties of the form in question that needs to be changed so that a single click displays the next record?
I have set up this database here for my new sole trader business. In it I enter data of my purchases and my gross sales. I have generated 2 queries both based on the same tables. 1 calculates the purchases and the other the sales.
I want to be able to subtract the purchases from the sales so that I can see my profit at any point in time.
The complication is brought on I think from the fact that I am using one table for both Purchasing and Sales. However, I use a filtering method to separate the two.
I have a report that requires the user's input for a field called UserID.
I also have a form in which I want to have a button that can be used to print off this report (which would involve automatically entering the UserID into it). How do I do this?
Here is the code for the form button that I am using at the moment, but when you click it, Access still needs the UserID (duh!). So, how can I automate the input?
Code:Private Sub Command25_Click()On Error GoTo Err_Command25_Click Dim stDocName As String stDocName = "Menu" DoCmd.OpenReport stDocName, acNormalExit_Command25_Click: Exit SubErr_Command25_Click: MsgBox Err.Description Resume Exit_Command25_Click End Sub
I have a form that requires at least a transaction code (from a combo box) and a total value field (numeric) to be entered.I have used the following code but when I click OK on the message box the form is closed.I want it to remain open so the user can enter the fields and properly save the record. As the code is in the Before Update event it does the same thing if I have Cancel = true.
Private Sub Form_BeforeUpdate(Cancel As Integer) ' Check to make sure the TransCode has been selected and the total field doesn't = zero 'If Me.cboName.ListIndex = -1 Then ' MsgBox "A value is required for ...." ' Me.cboName.SetFocus ' Cancel = True
I have a form that has several sub forms and what I want is that if the user chooses Plan Name in the main form "No Fault" or 'Workers Comp". I want message to pop and go to the field in the subform to enter data but I keep on getting an error.
Private Sub Plan_Name_AfterUpdate() If ([Plan Name] = "No Fault") Then MsgBox "Enter additional information in No Fault form before continuing." DoCmd.GoToControl ([NoFaultWCompsubForm]![Attorney Name]) End If End Sub
It says the action or method requires a control name argument?
Hey all! This is my first post. Been searching through the net all day trying to find a solution to this problem. Basically i have a table that looks like this (regular text is what i have and bolded text is what I need:Name Date Qty MOBrad 12/12/2007 23323 4423John 12/11/2007 3445 4432 John 12/11/2007 344 4432 John 12/11/2007 45 4432 John 12/11/2007 44 4432 John 12/11/2007 3445 4432 Grand Total: (Qty)And then I'd like to be able to carry this over and display a grand total at the bottom of every page of a report that I would need to generate. Our company produces forms and we sometimes have 60 - 70 people working on a single job. We want to see their hours individually but we would also like to see a grand sum of all their hours. If someone could help with this or needs more info let me know. Thanks for all your help!
I hope someone can come up with a suggestion for this one.
I have a Crosstab query in my database which looks for the age of accounts on each status. The query itself runs fine but the problem is if there are no accounts on that status. For instance if there are no accounts on an open status then the Open Status isn't shown.
This means that when my Excel Query looks for the Open value from the query I get a Microsoft Jet query error.
Is there any way to force the crosstab to display all the statuses regardless of whether there is any accounts on it.
I have created a form based on a query. On this form, there are command buttons that when pressed, exports a file to excel. This export is based on a query, then using a macro using the TransferSpreadSheet action. It works great.
On this form there is a check box which is tied to each person on the form. Is there any way to export to Excel ONLY THOSE PEOPLE WHO ARE CHECKED?
These are fields that are imported from Excel. I have to import 500-1500 rows each week which contain the data I need. Then I must, by using a form, go through these "Service Calls" and mark some that give the employee credit for the call and some that are unique calls. Meaning if they have serviced the same person 5x in the quarter I can only count that once.
There can be muliple people on a service call so I have these:
EMPLOYEE1 EMPLOYEE2 EMPLOYEE3
(Entered_By field contains the employee who recorded the call and they would have gone on the service call)
Then I have to record who they contacted regarding the account. The SHORT_ACCOUNT_TITLE will often differ from who they have contact regarding this account. So I have this field:
CONTACT
Then since muliple employees go on service calls together some may have already contacted this customer aleady. I have to keep track of employees unique customer contacts. So I have these fields:
CREDIT1 (checkbox for employee listed in the ENTERED_BY field) CREDIT2 (checkbox for EMPLOYEE1) CREDIT3 (checkbox for EMPLOYEE2) CREDIT4 (checkbox for EMPLOYEE3)
Then I have to keep track of service calls regardless if they where unique ones or not. So I have this field:
ELIGIBLE
Then I put a notes section in so when I am filtering the data and finding what calls where good calls and need to make changes or whatever I can have a place to put that:
NOTES
Finally since some of these customer calls involve large amounts of customers (group meetings, etc) I have this field to type in a number of additional credit:
So since I have to import Excel rows that contain the data I start with I am unsure of how to set this up and normalize it. I have attached my form I have used to find what fields I would need to show you more of what I am trying to do.
This form allow me to filter data that shows up in the subform. Then I can just double click it and bring up the record. Then mark the ones that count.
I am exporting from access to excel using the code below, but I'd like to edit the code so that it exports to excel for each original value in column A. For example, if column A contains the values "Type A", "Type B" and "Type C" then I'd like to export/save three different excel files (one for "Type A", one for "Type B" and one for "Type C"). If "Type A" appears in column A seven times then I'd want to export all seven rows for columns A through E.
Code:
Private Sub ExportToExcel_Click() 'Declaration of variables for file path Dim CurrentFolder As String Dim FileName As String Dim CurrentCycle As String 'Initializing CurrentCycle = Format(Date, "yyyymm") FileName = SVCnumber1 & "Output.xls"
i want to write a ms access query for date difference.i have the excel formula for that.in attachment i have shown wot i really want as output.i want to make a IIf query for these conditions.
in excel i did this like: =IF(J13="",IF(INT(B13)=INT(AE13),C13-DAY(I13)+1,C13),IF(INT(AA13)=INT(B13),IF(MONTH(J13 )=MONTH(I13),J13-I13+1,DAY(J13)),IF(INT(AA13)=INT(D13),DAY(J13)-E13,0)))
I am writing a module to send information to Excel, and the information is based on a Crosstab query. But I keep getting a "syntax error in the TRANSFORM statement".
Function Edt_Royalties() As Integer Dim AplicExcel As Excel.Application Dim Planilha As Excel.WorkSheet Dim stArq As String Dim DB As Database
Suppose there's a simple query which has two fields, "year" and "graduates", where "year" can be grouped by "2012", "2013", etc and "graduates" are individual names.
How can I export the list of graduates to multiple excel files, with the filename based on "year"?
I have tried to set the output file in macro as "c:desktop" & query.year & ".xls"
But it's not working and the output filename is exactly "&query.year&.xls "and the file contains all year and all names.
I have a graph chart and my row source type is a Query. So I retrieved data from the Query that I built.
However , I want to get the data from the uploaded excel file.
I have a form that will prompt user in the beginning to upload the excel file and replaced the old table in Access- "CrossSystemData"
Basically , I want to pull data from Excel file , Run the query(Data from excel file) then excute to "display a chart based on my query" ... Is it possible ?
Query SQL: "PolyWrongRegInsCount"
Code: SELECT GROUPING.INSTITUTION, Count(*) AS NO_OF_GROUP FROM (SELECT DISTINCT CATEGORY, GROUP_NO, INSTITUTION, IIF(Left(INSTITUTION,1)="P","POLYCLINIC","HOSPITAL") AS INS_TYPE FROM CrossSystemData WHERE INSTITUTION NOT LIKE "*UNKNOWN*") AS GROUPING WHERE (((GROUPING.CATEGORY)="WRONG REG") AND ((GROUPING.INS_TYPE)="POLYCLINIC")) GROUP BY GROUPING.INSTITUTION;
My Chart SQL :
Code: SELECT PolyWrongRegInsCount.[INSTITUTION], PolyWrongRegInsCount.[NO_OF_GROUP] FROM PolyWrongRegInsCount;
how data is best structured in Access.I have a table of values (for instance: weight) and I need to be able to look up a weight based on the column header (age) and row header (height).How is this sort of data best structured and accessed in Access?
I have just begun learning MS Access and have some information already in an excel spreadsheet that is getting too big and I am trying to decide if converting the whole thing would be beneficial or jsut a waste of time.
The issue is the current excel file is a workbook of about 150 separate worksheets that are all hyperlinked to each other. It does everything I want, but I feel like it is getting to big and cumbersome and really all I want is to add one sheet/record and have all the totals/averages/"reports" update themselves. That is why I think Access might be better. Currently it takes a good minute to update the file when saving. The Excel file is about 13mb.
The data is basically all times from a mens & womens cross country team. I have one form I take to each meet and record mile splits, places, final time, etc. Then I return and currently put those times into excel. I have 4 years of data for each runner. I also have 10 years of team data that needs to be able to be recalled usefully. My spreadsheet also looks through all past meets and keeps a list of the top 50 times for both men and women. And compiles every practice/workouts for the past 8 years, etc. Plus a lot of other sheets/forms/reports/.
I started a database and have one table for Athletes, one for MeetEntry. I also created a report for the meet entry to send to media. I then started working with relationships between different tables and became overwhelmed with how to best set up the entire database. I came up with a list of things and organized them into what I thought would be best suited for Tables vs. Forms vs. Queries vs. Reports. With the limited info, any ideas on setup would be appreciated. Maybe I just leave it in Excel and forget Access.
I think with the complexity, this is much better suited to my needs but it may be just a bit over my head. I do not know an VB so that is also an issue.
first time poster, please be kind. I am currently updating our supply stores database in work. When an item becomes unserviceable we need to attach a form to the item before sending it away. i would like the data entered into the 'unserviceable' table within my database to be transposed onto an excel spreadsheet (see attachment) and then automatically printed out with the data in the relevant boxes. Can anyone tell me how this is done please? My knowledge of access is rather limited and I am teaching myself as I go along.
I have a a database with a large number of email addresses in it. I also have a list of email addresses stored in an excel file.
I would like to take the excel file and use it to check for the same email addresses in the access database and if they are present in the database add content to another field in the database to flag it.