Search results

  1. L

    Open Excel files in subfolders on desktop

    Hi, temp is not recognized as a variable. It should be declared as String type? Thanks
  2. L

    Open Excel files in subfolders on desktop

    Hi there, I have some pieces of code that I am hoping to open a some excel.xlsm files in subfolders within a main folder to do some simple manipulations. file path for the 1st excel file: C:\Users\GJ\Desktop\TEST1\aaa.xlsx file path for the 2nd excel file: C:\Users\GJ\Desktop\TEST2\bbb.xlsx...
  3. L

    Count duplicates only once

    It worked. Thank you. Is my understanding correct? If I don't specify CurrentRec = rs("pt_acct"), then Access will start evaluating the next line at the beginning of the recordset. If I do specify, then it actually starts evaluating on the first record.....? Sounds like I am still confused...
  4. L

    Count duplicates only once

    Hi, This almost works. The first two records are both showing a 0, which based on the logic, it should be 0. However, the first record has to be a 1 regardless. How do I force that? Public Function cohortFinalizer() Dim rs As DAO.Recordset Dim db As Database Dim CurrentRec As String Set...
  5. L

    Count duplicates only once

    I changed to the right column names. Almost there. The loop works and while it seems that it is putting in a "1" only on the last record for each of the same pt_accts, which is fine for my case, the first two records are skipped. I do not know why. [code] Public Function cohortFinalizer() Dim...
  6. L

    Count duplicates only once

    Ok, I have more codes, but it seems to an infinite loop.....what am I missing here? Public Function cohortFinalizer() Dim rs As DAO.Recordset Dim db As Database Dim CurrentRec As String Set db = CurrentDb Set rs = db.OpenRecordset("select test.pt_acct from test order by test.pt_acct")...
  7. L

    Count duplicates only once

    Hi, This is what I have, but I am having trouble completing the loop part. How do you compare only the records where the pt_acct is the same? The code is in the mod. Thanks
  8. L

    Count duplicates only once

    I need this field for filtering in Excel later on. I essentially will need to output this table into Excel and apply conditional formula for subsequent steps, but for now I need to fill the 1s and 0s in this column. Thanks
  9. L

    Count duplicates only once

    Hi, I am trying to loop through a table and count the duplicate records only once. Please see the attached file. 1) In the test table, I want to loop through all pt_accts. 2) In the countable column, if an acct repeats, I essentially just want to put "1" in one of the records. For the...
  10. L

    Update graph's usedrange, VBA

    Thank you. the requirement has just gotten changed, but this is working. Thank you.
  11. L

    Special paste by values, variable not found

    Hi there, I'm trying to paste the values of worksheet 1 by value. Please see the attached two files. When I run the code, it indicates that variable ( xlpastevalues) is not defined. It is not a variable.... can someone help? Private Sub Command0_Click() Dim xlApp As Object...
  12. L

    Update graph's usedrange, VBA

    Can someone help me look into this?
  13. L

    Update graph's usedrange, VBA

    Hi there, I am trying to update the range for the graph automatically and I'm calling this from Access because my data exists in Access. I've attached a sample file. what I am trying to do: 1) click on the button 2) button will update the usedrange in "trending" tab 3) have the graph's data...
  14. L

    Textbox displaying the Min()

    Ah easy fix. Thank you!
  15. L

    Textbox displaying the Min()

    I have actually changed the textbox into combobox, allowing users to select a particular date. How would you write the code if you are using DMIN()? The textbox is not bound to the form. (it says unbounded textbox). How do I get it to bound to the form? Thanks
  16. L

    Textbox displaying the Min()

    Hi guys, I have a blank form, and it has two textboxes which are meant to show 1) from date 2) thru date in the control source of my first textbox, I put in.... =Min([TEST].[Dates]) but I'm getting ERROR in that textbox. Basically I want to just find the smallest date in the column...
  17. L

    converting from mm/dd/yyyy to dd/mm/yyyy

    hi there, I am doing this in query grid: CDate(Format([test].[RefReferredOn],"dd/mm/yyyy")) In table test, the refreferredon is already a date/time format (in mm/dd/yyyy) When I run this query in Access, I still get the dates in mm/dd/yyyy format. What is the next step to get it in...
  18. L

    Import csv into Access, 2391 error

    Hi there, I'm simply trying to import a csv file into Access regularly using this code Sub Command0_Click() 'import from text file DoCmd.TransferText acImportDelim, , "test", "M:\testR.csv", "-1" End Sub The error I'm getting is attached in the word doc. I have no idea what that weird...
  19. L

    Compare admission date to previous discharge date, VBA

    Hi, I have attached a sample database. Basically I want to have some lines of code that generate the result table, which is tbl_readmit_result. As you can see, the difference is the addition of a new column called re_admit_status. Rule is: Status = "y" when the admission date, compared to...
  20. L

    Access 2010 write to Excel 2013, application defined or object defined error 50290

    Hi there, I have an access application that writes data to Excel 2013. I have tested it on both Access 2010 to Excel 2010, and it worked, but not when I switch to Excel 2013. Is there a way to have Access 2010 open Excel 2010 instead of 2013?? This is the code in Access 2010 Dim xlApp As...
Top Bottom