I have one table, called tblTransactions, which contains records on security market transactions. For each buy and sell order, respectively it contains one dataset with columns Date, Ticker (i.e. the unique identifier of each security), Quantity (positive for buy, negative for sell orders) and Price (at which the trade was executed).
The following SQL query code gives me then the composition of my security portfolio as per any arbitrarily chosen date (here 1/10/2007):
SELECT [tblTransactions].[Ticker], sum([tblTransactions].[Quantity]) AS TotalQuantity
FROM tblTransactions
WHERE [tblTransactions].[Date]<=#1/10/2007#
GROUP BY [tblTransactions].[Ticker]
HAVING sum(tblTransactions.Quantity) >0
ORDER BY [tblTransactions].[Ticker];
For instance, for some trades like the following...
However, I would like to add a column to this query, which gives me the number of trades for each particular stock. For instance, the query result based on the sample data above should look like follows as per 01/20/07:
I have to write a PHP web front-end to a client-server MS Access applicatin, and I think I've hit a stumbling block.
I use ADOdb as my db abstraction layer, and it has transaction functionality built in. I've tried it with Access, and while according to the output of the code the transaction has worked, I see clearly that it has not worked.
If I insert an intentionally malformed statement as part of the transaction, none of the other queries are rolled back upon the failure of said transaction.
I know this is an Access forum, not a PHP forums, but I've gotten zero response to this post on PHP forums.
Does anyone know if there's a way I can implement transactions for Access via PHP?
I am trying to run a transaction in my databases and I’m having problems with rollback. I have an append query and a delete query that I’m trying to run Just a test I begin the transaction, run the queries and then rollback the transaction. For some reason the rollback isn’t working. Please look at my code and let me know what I’m doing wrong. Are transactions not available in DAO? Also, how do you tell if all records were updated – How do you know when to Rollback?
Sub ArchiveRecords() Dim db As DAO.Database Dim qdfArchive As QueryDef Dim qdfDel As QueryDef Set db = CurrentDb Set qdfArchive = db.QueryDefs("qry0201ArchiveLayoffs") Dim cnn As Connection Set cnn = CurrentProject.Connection Set qdfDel = db.QueryDefs("qry0202DelArchiveLayoffs") cnn.BeginTrans qdfArchive.Parameters(0) = 1 qdfArchive.ExecuteqdfDel.Parameters(0) = 1 qdfDel.Execute cnn.RollbackTrans End Sub
I am working on a financial integration system that receives lists of financial journal transactions from several accounting packages.
I import and sumarise the transactions and end up with a transactions table like the one below. I now want to produce an Accounts summary (by period) table. I am trying to figure out how to do this just using SQL.
I do not want to use record by record VB because it is slow and I have a million+ records.
Can anybody help ?
Transactions Table (input)
Account Period Amount 1011100 1015 100
Account Summary (desired output)
Account Period Opening Movement Closing 101 10100100 10121000100 10131000100 10141000100 1015100100200
I'm in over my head with something I've been asked to do at work as my access skills are pretty basic.
I need a sample database containing PRODUCTS and SUPPLIERS, that lets you book IN stock received from the supplier (and adds to the stock level) and lets you book OUT stock issued to staff (and reduces the stock level)
I'll have a go at reorder levels, form design, stuff like that myself, but I'm having trouble with these very basic requirements.
Does anyone know of a sample database that I can download to learn some of this from?
I need to create distinct transactions for each invoice, so that if the static data changes, such as rates of charge, it will not automatically update any history, where a historic rate has been charged.My current thinking is that I create a table and effectively archive all invoices that have been created, as they are produced.
I am building an application for a small clinic. In the interests of good database design, I don't want to be storing numbers that are derived by calculation.
A patient with insurance will have a deductable that will be entered into a field on their first (ms access) transaction form.
A calculation will put the remaining deductable into another field. No problem. However, the NEXT visit has to look back to find previous transaction records, again perform the initial calculation and then perform another for this transaction, and again the next time and the next until the deductable reaches zero.
Additionally, since I'm not storing these values, if I pull up an old transaction form, that form has to re-perform the calculation ONLY on transactions from that date and earlier. It must not reflect visits that took place later.
So, this field must query tblTransactions, filtered by the name of the patient (a combo box called tblTransactions.Patient_Name that looks at tblContacts), the transaction date/time (stored in two date/time fields, cleverly named tblTransactions.Date and tblTransactions.Time), and the total deductable value stored in a field called tblTransactions.Deductable.
As someone who has never coded anything more complicated than DOS batch files, I'm at somewhat of a loss as to how to go about this.
Any assistance, code-wise and which Property value to put it in would be MOST appreciated.
I am creating an EPOS system for a bookstore and I have a many to many relationship between the transactions table (tbl_transactions) and the products table (tbl_products) using a link table (tbl_linktblproductstransac). The below diagram shows what i mean below:
I made it many to many because 1 transaction can have many products on it and 1 product can be on many transactions.
Now what I need to know is how will i make records with more than one product on one transaction (in the table itself or in a transaction form). I would really appreciate if someone could help. Thanks :) and have a good Easter
I am using the code below to evaluate values for each transaction to determine the median:
Function MedianF(pTable As String, pfield As String, pgroup As String) As Single '******************************************* 'Purpose: Return median value from a recordset 'Inputs: ? medianF("Values", "Industry") <enter> 'Output: results are currently incorrect '******************************************* Dim rs As Recordset Dim strSQL As String
[code]....
The code generates median results based on the value but not the correct ones, as I check results in Excel using the Median function. I need to see the median for the transactions within the same industry and I do not know how to do that . Below are some sample transactions including the Industry, Value, mymedian (which the current results based on my code) and the expected median result (which I calculated in Excel based solely on the transactions listed here). Note that mymedian results listed in the 3rd column are determined using the complete data set (over 2000 transactions). I only included a few sample transactions below to show that I am currently getting 2 different median results: 44.62 and 50.82. Also be aware that I do not want to evaluate any zero value transactions, which I believe I am handling in the strSQL line above where I indicate <>0 . I need to see a Median result for each industry and the result should be the same for all transactions within the same industry.
Industry Value mymedian Expected Median Aerospace 18.01 50.82 40.45 Aerospace 53.02 50.82 40.45 Aerospace 109.18 50.82 40.45 Aerospace 61.54 44.62 40.45
[code]....
This is how I am passing the values from the query to the module, passing the value of Period2 if Period 1 = 0, else passing Period1:
I am using Access 2007 and have inherited a database. It has linked tables of Excel spreadsheets that are information extracted from our main system. The user wants developing a much faster and customized approach to billing the customer based on payroll related information.
There is a table of payroll billing transactions and it has the following record lay-out,
job_num, employee number, employee name, union group, rank, regular hours, overtime hours, other hours, trans_date, seq_num
On December 1st John Doe worked 8.0 regular hours as a pipefitter foreman on job number 6430 and this is record (sequence) number 254333.
There is another table that defines the union group. I am not concerned with this information at this time. The seq_num is a sequentially and uniquely assigned number given to each billing record in the main system.
There is also a Rate Master table and it has the following record layout,
job_num, union group, rank, regular_billing_rate, overtime_billing_rate, other_billing_rate
I am struggling as to how to relate these two tables so that I can develop some queries from it.
I have a pop up reports tied to my form so the usere can press the see list report of all the equipment they just scanned in or out of the building. I am useing the Date/Time data type (General Date) What I would like to get out of the query is when the user clicks the button it will show all entries from the time right before the button is pressed AND through 5 minutes earlier. (That would be the time that the user would of started scanning the equipment.
This is my current criteria : Between Now() And Date()
This is returning all transactions for the day. I really only want all transactions for that session.
I am trying to calculate the stock level for my spareparts. I am aware of that I am not to update the stock level in my table but calculate the total from the transactions.
I have a report due the first of each week in which I need the cases open and cases closed for the previous week, the week two weeks prior and the 2007 and 2006 year to date on two different types of cases. I have a case management table with a field for Type of Case, date assigned and date closed that I uses in my queries. Presently I have two query, one that generates only Type 1 cases from the Case Management Table and another for Type 2. I then use the Type 1 Query in another query that limits the results for Type 1 cases to those opened last week, one for those open two weeks ago, one for 2006 YTD and one for 2007 YTD. In these 4 queries I have one field [Type of Cases] and I have the query count. I then do this for Type 2 cases and then go through the whole process to do Closed Cases. All my queries have criteria to automatically filter the dates to the time periods mentioned above. I then have one report query that I put all the number in for my report. This query has 16 fields with the numbers for each period, last week open and closed, 2 weeks open and closed, etc. I then generated a report that takes these numbers from my report query and puts it in a report format automatically. As you can imagine this takes some time to go through each query to generate these numbers, so I was wondering how I may do this differently. Also, I have experienced a problem when a field produces no records I get a blank sceen with nothing under the Count of column and get the same thing for my report. How can I fix this.
I have a set of transactions with a Unique ID field and a date. I want to add a field based that gives me the sequence of events for each Unique ID in order of when it happened.
For example, if customer X has 6 transactions, the sequence field would have a number (1-6) in each record that corresponds to the order in which those transactions occurred. The first transaction would have the number 1, the second would have the number 2 and so on.
I have a products form, we are a manufacturing company, with a listbox to show recent inventory transactions. This is based on a query which shows all transactions with the current part id, and that all works well and fine.
The problem is, I would like to limit this query to show only the last 10 transactions in the listbox and not make it editable, ie not enabled. I set the show only in query design view to 10 and it says in the sql statement select top 10, however, the listbox consistently shows all related records. What am I missing?
I have a module which reads a CSV transaction file line by line and adds the correct transactions to an access table and places the wrong ones in a logfile.Now some transactions are rejected twice there is even one rejected six times. Whereas one wrong transaction is processed only once. I am certainly overlooking something obvious in the logic but what. Here is the relevant code.
Code:
Function ImportCSVForConfederation(inputCSV, ORG) Dim TNO As Integer, TACT As Integer, TABLE As String, TLINE As String, I As Integer, J As Integer, K As Integer Dim FLD1 As String, FLD2 As String, FLD3 As String, FLD4 As String, LogFile As String, LogPath As String Dim Lim As String, ITNO As Integer
I have a form which displays which products are on sale but I want it to count stcok orders down, i.e. if there are 10 stock and someone orders 1 I want the system to automatically recognise that there are only now 9 in stock, any ideas? Help really would be appreciated!
I have a form called feedback which has three columns and each cell in a column has a combo box that holds (Yes/No/Empty), and I want to count each column's value for example let's supposed that:
feeback number: Column 1 (Are You happy) - Column 2 (Are you sad) - Column 3 (Are you hungry) 1 : Yes - No - Yes 2 : Yes - Yes - Yes 3 : No - No - Yes 4 : empty - No - yes
Counting: the next step is that I want to count:
values in Column 1, where number of Yes =2 , and number of No=1 the stum of Yes + No = 3 and empty = 1 values in Column 2, where number of Yes =1 , and number of No=3 the stum of Yes + No = 4 and empty = 0 values in Column 3, where number of Yes =4 , and number of No=0 the stum of Yes + No = 4 and empty = 0
So, how can I apply this concept in MS ACCESS (2000-2003).