Which implies there can be 1
So your aggregate query would need to be modified to be conditional on the max <> min for bin 2
Iif(max <>min,max) as bin2
@xavier.batlle - you're a star :) - that works.
With xlWS.QueryTables.Add(Connection:="TEXT;" & csvPath, Destination:=xlWS.Range("A1")) QueryTables is the key
I had tried similar to no benefit using fileinfo (also generated by chatGPT)- but the difference was it suggested using...
this is what I used to do, quite happily for several years. See post 12 for the manipulation required.
I can solve 1 and 2 easily enough with sql, 3 is not too bad but a departure from the standard process for other banks, 4 is a problem as I need to introduce a sort column to reverse the order...
Is this what you mean? Since we are talking about a CSV file, I wasn't sure what you were suggesting since the issue is Excel opening the file
the problem is opening the file using Excel opened in Access. It works fine if I use SQL on the csv file but manipulating it without going too far...
@DickyP - completely agree, but the level of manipulation is high
The bank in question has a new system with many changes, in particular to do with exporting transactions
1. Account number (to identify which nominal code to be updated) - used to be in the file name, now it is in the first few...
Yes - As mentioned, the problem is any date from 1st to 12th is treated as US style and we are in the UK
@Minty - will be very interested to see what you did
I've just tried creating an xlsm to run the import and opened and executed from Access. Same issue.
My old routine opens the csv file...
The .csv file looks like this - dates are correct. Open in Excel, and dates are correct
I've deleted sensitive data and attached the file - use the code in post#1 and just change srcFile to the path and name of the file. You'll see the 1st July dates change 7th Jan.
I've tried that - but...
I'm using a sub in ms Access to open an instance of Excel, which in turn opens a csv file. It then manages the data into a standard format (delete header rows, calculate some columns and change the sort order) to then save as a csv file for subsequent upload into an Access table.
The files are...
Step through your code to check what you actually have
Small issue- the year function returns a number but you are treating yearval as text. Doubt it makes a difference but you should keep to the appropriate data types
And try setting filter=“” to clear it
As suggested by xavier, seems to me the switch option is the way to go since this is in a query
Expr1: Format([fld],Switch([fld]=0,"-",[fld]>-1 And [fld]<1,"0.0",True,"#"))
important to get the order of testing correct
One of my clients uses a bank which changed to a new system which apparently had been ‘extensively tested’ before being released. Nothing worked reliably from being able to log in to processing payments to downloading transactions.
Even the 100 page manual you get pointed to has errors such as...
My bad - but see you worked it out. To sort in date order, you would need to specify year before month e.g. yyyy-mm
You don’t need to display the sort column