once again I need your help, I have no idea how to tackle the following problem. I am taking records of stock market transactions. As a final result I want to have a query which gives me for every end of the day the total value of my portfolio. Therefore I have two tables. The first one, called tblTransactions with columns - among others - Date, Ticker, Quantity, Price does contain my transactions. The second one, called tblQuotes with columns Date, Ticker, LastPrice contains prices for each security traded for every day. The following SQL code gives me the portfolio holdings with the respective LastPrices on an arbitrarily chosen date (03/09/07):
SELECT T.Ticker, sum(T.Qty) AS TotQty, Q.qCl AS [Last Price], (T.Qty*Q.qCl) AS [SubTotalValue] FROM tblTransactions AS T INNER JOIN tblQuotes AS Q ON T.Ticker=Q.qTicker WHERE T.Date<=#3/9/2007# And Q.qDate=#3/9/2007# GROUP BY T.Ticker, Q.qCl, (T.Qty*Q.qCl) HAVING sum(T.Qty) >0 ORDER BY T.Ticker;
This works so far. However, now I struggle with the next step. I want to have a query, which for each date (I could use the date column of tblQuotes) adds all SubTotalValues, i.e. gives me the total value of my portfolio for each day.
Could you give me please some hints on how to proceed from here? I would be very pleased if somebody could help me with that question.
Let's say that you have a cookie jar that's to be shared with two children, let's call them Jack and Jill.
You know that to start with (t = 0), there are 100 cookies in the cookie jar
Now the strange thing about Jack and Jill is that they start eating cookies on different days and that their cookie appetite depends on the number of cookies in the jar when they start, Specifically
Jack has an appetite of 10% of the total cookie jar and he starts eating on day one.
Jill eats after Jack and she has an appetite of 5% of the jar.
So what this would look like is:
Day 0 - Cookie Jar has 100 cookies Day 1 - Jack eats, Cookie Jar has 100 - 100(10%) = 90 cookies Day 2 - Jill eats, Cookie Jar has 90 - 90(5%) = 85.5
Problem:
1. Given that I have a table containing the starting number of cookies e.g.:
CookieTable Startingcookies 100
2. Given that I have a table containing a record for Jack and a record for Jill, each with two fields: Eating Start date, Appetite % e.g.:
I have been struggling with understanding Queries related to Time Series. I find it difficult to get the right answer or understanding how to ask the right question Access style.
Table below is a sample data/table example for my question. The intent is to build a query that will return the latest date for each unique/Distinct name. I have Time Series Table that I haven't been able to do this, it doesn't return with Distinct Name. I Also have included a sample database.
TABLE Name Date_1 Distance ------- --------- ----------- A 1/1/2014 10 B 1/3/2014 5 C 2/1/2014 10 A 1/3/2014 16 A 2/5/2014 3 B 5/1/2014 5 C 6/2/2014 6 C 7/1/2014 7
ANSWER SHOULD BE. Name Date_1 Distance ------- --------- ----------- A 2/5/2014 3 B 5/1/2014 5 C 7/1/2014 7
I currently have 3 spreadsheets with simliar information. How can I take a database and export only select fields to make either a report or table? Here is the example with types of info i will be using:
100 communities and all their roads. Each of these communities are in a borough, which is then in a region.
Then we have a mileage for each road. Where I have difficulty is that we have another set of data that would be fine if we could just include into this which is all of those roads but additionally they have:
Some roads have two classifications.. each of those having a mileage. I would really like to see all of this data in a database that spits out the needed tables and totals.
I have made a program that can identify a entry in a field (ID) and change the quantity of a field. However, if can only identify numbers. I have the code as follows:
Code: Option Compare Database
Sub AddToInventory() Dim tb As DAO.Recordset Dim I As Integer I = 1 Do Until I = 2 On Error GoTo Canceled
[code]...
The "where ID2 = " only works with numbers. Is there anyway I can make this work with Strings? Basically, Find the string in a column and update the quantity.
I need to sort out the repeat customer, e.g. I have a list of customer's name, like Nike, Emerson, Alcan, etc... and if they sign another contract with my company again this year, I will name it like Nike 05, Emerson 05, etc...
So how can I get the result of how many customers have signed the 2nd contract with us. I have no clue now... :confused:
I have data for multiple account numbers (for work) and dates, and I need to identify when there is a change in account number in order to add a new field with a count - which counts sequentially starting with 1 and then starts over at 1 when the account number changes.
I have been consistently getting an error almost every month when I try to load some data that has been input into access, then I have it linked to an excel sheet so that whenever I refresh, the access data imports into excel and updates my pivots, charts, etc.
When my data entry ppl enter data, sometime they forget to enter a code, or something, and when they forget to enter that, it creates some kind of error in the query. The query still runs in access, but shows something similar to " #ERROR#" in the field IF I ever do find it in the access query. The issue is that I cant filter to find that error. I literally have to scan and scroll through thousands of lines of data to try and find this error. When I try to refresh the data in excel, the following error message pops up;
"Data could not be retrieved from the database. Check the database server or contact your database administrator. Make Sure the external database is available, and then try the operation again."
In past months I can usually find the #ERROR# by scrolling through access and finding it. Some months I have EXTREME trouble finding the error. It can take hours out of my work day. Is there any way to more easily identify which line these errors are in rather than scrolling through thousands of lines of data? Is there a way to still export the data to excel with the errors still in them?
I have some project run on MS-Access as front-end with database linked to MS-SQL Server. I have some column of table contain Date-Time data that store data as General Date format (ie 01/01/2005 08:00:00). I create some form for my staff to key in a data of lab test that they will be key in only time with out date value. On form, I show this value as time only too. But I want to use this data with Date value for some calculate as backgroud process.
So...
In case of new data, Database will be store my data as CurrentDate with Time that my staff key in.
In case of data update, Database will be store my data as ExistDate with Time that my staff may update.
I have some project run on MS-Access as front-end with database linked to MS-SQL Server. I have some column of table contain Date-Time data that store data as General Date format (ie 01/01/2005 08:00:00). I create some form for my staff to key in a data of lab test that they will be key in only time with out date value. On form, I show this value as time only too. But I want to use this data with Date value for some calculate as backgroud process.
So...
In case of new data, Database will be store my data as CurrentDate with Time that my staff key in.
In case of data update, Database will be store my data as ExistDate with Time that my staff may update.
I have a project that contains about 200 very small .mdb's. For reasons that make no sense, I have to keep all these little .mdb's separate.
What I'm interested in doing is to run a query against a table in each of the .mdb's and if I find a certain record in the table within each .mdb, have a record written that contains the name of the .mdb in which the record was found . In other words, cycle through all my .mdb's, check my specified table, write my notification record, and then repeat the process for the next .mdb.
Can this be done? Does anyone have an idea or suggestion? I know I can do this separately, but that would be a pain.
If anyone can offer assistance, I would be most appreciative. Thanks!
I have a form on which there is a series of text box controls relating to different frequencies. At the moment I enter a value in to each of these manually.
However, I would like to have an unbound text box where I can paste in all the values (6 or 8 of them) from excel and then press a button and they would be copied in to the individual boxes.
So far I have my design:
I'm not sure where to start with regard to the code as I don't know how to handle delimited text - is it column delimited in excel?
I imagine some sort of loop, such as a do until will be required but again not sure.
I 'm downloading the excel data from the site and connecting it to access.
In excel the particular column (Time Taken) is in the format of "00:12:26".
After connecting it to access and appending it to the table, the format changed to "12:12:26", the first two digits changed to "12" and the remaining are as it is how it looks like in the excel. I need to change it to format what it looks like in the excel.
I have the following code that Cycles through a listbox that has columns associated to it:
Dim db As DAO.Database
Set db = CurrentDb
lstOrigin.SetFocus For i = 0 To lstOrigin.ItemsSelected.Count - 1 txtAmount.SetFocus For x = 1 To CInt(txtAmount.Text) strsql = "insert into tmpJob select dbo_jtJob.* from dbo_jtJob where jtJobId = " & lstOrigin.Column(0) db.Execute strsql Next Next
This code works fine and so if I multi-select the lstOrigin.Column(0) value changes correctly as expected..
I now have a second listbox also set with columns and set for multiselect:
The code I have for this is :
Dim i As Integer Dim strCriteria As String
strCriteria = "key in (" lstDestination.SetFocus For i = 0 To lstDestination.ItemsSelected.Count - 1 strCriteria = strCriteria & lstDestination.Column(0) & ", " Next strCriteria = Left(strCriteria, Len(strCriteria) - 2) & ")" DoCmd.OpenForm "JobCreateTemplate", , , strCriteria, , acDialog
Now in this one lstDestination.Column(0) always equals the last item in the items selected index. It iterates the loop the correct number of times. I cannot see what I've done different that the process works in the first lot of code and not the second.
hello i wish to trigger some VBA code when the user jumps from the present record to some other record on the form. there is the On Current event but that only applies to the record you are jumping to. i wish to process the information on the present record if u choose to jump to some other. BTW my form my form only shows one record at a time. Please help me out here. :confused:
I'm trying to set up a looping code to go thru each record in a query. I know in excel I would set the cell value to a range and offset to get to the next value. How is this done in Access?
I have a form with a list box, which lists all those registered for a student orientation. I then have a button to an unbound report which prints a registration worksheet. This report looks up the student's name, test scores, suggested courses based on those scores, and various other information from multiple tables, assigns them to variables, then to controls on the report. This is done in the On Open event of the report.
But it was designed to work for record highlighted. Which was fine until now. Now I'd like to take it one step further and have it go through the list from beginning to end, printing the report for each record in the list.
Maybe I am missing something simple, but I can't seem to pull it off. The closest I can get is getting it to print the first record n times.
Formatting issue regarding elapsed time calculated using DateDiff().
I understand that you can specify the output value for DateDiff(). In my case I have chosen "n" for minutes. Each result in my query shows the correct calculation in terms of minutes.
[PunchIn] = 11/23/2013 8:11:28 AM [PunchOut] = 11/23/2013 5:43:30 PM
Now when I try to format the result in terms of H:MM (be it in a form or a report) I get varied results. I'll illustrate an example below:
=Format(([ShiftLength]/60),"0") & "." & Format(([ShiftLength] Mod 60),"00") Returns 10.32 Not correct
=Format(([ShiftLength]60),"0") & "." & Format(([ShiftLength] Mod 60),"00") Returns 9.32 This is correct but I need my result to be in the form of a decimal such as my next example
=([ShiftLength]/60) Returns 9.53333333. Getting there but how do I have this result only show two decimal points 9.53?
Hello all. My client has decided they like the pivotchart format better than the regular chart format, especially for its dynamic quality ( it can expand and contract with form adjustments.
One chart I am having trouble replicating in pivotchart format is one that plots two data series. One series is made of columns representing large numbers, generally several hundred or thousand, and the other data series needs to be a line which usually ranges between 0-10.
Obviously they cannot be represented on a y-axis with the same scale. This is simple to handle in MS Chart.
Is there a way to make a pivotchart with a dual-scaled y-axis, and map a data series to each one?
I am trying to develop a form in the light of budgeting, therefore, I am designing a form with all possible options being an accountant I can think (it just a try nothing else)
Now here's the scenario
Fiscal Year Period Month Working days
Period - Month - working (are my heading) 1 - Jan - 22 2 - Feb - 18 and so on
This is what I am trying to learn, if I select period 1 "Jan", application/code fill -out remaining months automatically, e.g. Period 2 "Feb"; Period 3 "Mar" .....
and if I select Period 1 "Mar", then period 2 "Apr", Period 3 "May" ......
Currently, I am using combobox, but problem is, if I selection period 1 = "Jan", then I am unable to restrict period 2 using "JAN" as both combobox are separate.