Recent content by schniggeldorf

  1. S

    setting a primary key with vba

    Hi: I'm trying to import several spreadsheets from Excel into Access, then perform some "clean up" on the data. I have been able to import the spreadsheets into access tables, and my first task thereafter is to establish a primary key for each of the new tables. I found this code on the web...
  2. S

    Sub to export excel range to new access table

    Thanks to all who offered suggestions. Unfortunately, none of them worked. I eventually concluded that the 'not updateable" problem related to records I was pulling from Access into Excel in earlier code. Because of this, Access apparently saw Excel as a user, and locked its tables. I...
  3. S

    Sub to export excel range to new access table

    Hi: I am trying to write a Sub in Excel that would copy a range of cells from a Excel worksheet, and export them as a new table in an Access Database. My code, in Excel VBA is as follows: Public Sub ExportWsToAccessTable() Dim FullOutputPath As String Dim objAccess As Access.Application Dim...
  4. S

    Error 462 when code runs second time

    Static: Thanks for your advice. I found that if I didn't open an instance of Access, then after my code ran my database wouldn't open. By explicitly opening access, then closing it at the end of the Sub, I avoided that problem.
  5. S

    Error 462 when code runs second time

    Orthodox Dave: Thanks for the link. I'd read that post earlier, but it took until this morning before I figured out how to fully specify the Set db=... statement. (See above for what eventually worked.)
  6. S

    Error 462 when code runs second time

    Mark: Thanks for your help. I eliminated the workspace and rearranged the other code as you suggested. Subsequently, I got the same error message as before, just triggered by the Set db = DBEngine.OpenDatabase(constDbPath) statement. The reason I had created appAccess in the first place was...
  7. S

    Error 462 when code runs second time

    I wrote some code to evaluate each email as it arrives in MS outlook, evaluate whether it contained useful data, and copy the data from the body of the text. I then wrote the following Sub to send that data to an existing Access database. Everything works exactly as intended when I first run...
  8. S

    Cannot open database after record inserted by vba

    Thank you! Your date variable suggestion worked, and is indeed simpler than mine. I also changed the error handling as you suggested. Everything is running fine now.
  9. S

    Cannot open database after record inserted by vba

    Thank you! Task Manager indeed indicated that MSACCESS was running, even though it didn't appear in the Applications tab. Your solution worked as well.
  10. S

    Cannot open database after record inserted by vba

    Hi: I have written vba code in Microsoft Outlook that reads each incoming email, selects those whose subject line matches my criteria, then extracts particular data from the body of the message. All that code works as I wish. The attached Sub is intended to take the extracted values and insert...
  11. S

    Data type mismatch error when running sql query

    I tried your idea, even though I didn't see how it could work, but apparently it did. Thank you. Any idea why deleting parts of the criteria made the error go away, even though there were still numeric data being sent as criteria for a text field?
  12. S

    Data type mismatch error when running sql query

    I thought of the possibility that it's a problem because WeekOrder is indeed a text field. However, if that's the problem, why does deleting the Letter1="XYZ" specification solve the problem, even though the WeekOrder=3 remains intact?
  13. S

    Data type mismatch error when running sql query

    Hi: I have vba code that creates the following SQL: SELECT SubscheduleID, EventID, WeekOrder, DayID, StartTime, EndTime, Priority, CanJoin, PatientTitle, PatientNickname, IncludesPatient, IncludesAftercare, Letter1 FROM [qryScheduleCombinedDetails] WHERE (SubscheduleID = 1 AND...
  14. S

    using vba custom function in query expression

    Hello: I hope somebody can help with this, because it seems so simple, but still won't work. I have a Module containing the following: <code> Public Const NLetteredConst =2 Public Function NLettered() as integer NLettered=NLetteredConst End Function <code> In a query, I attempted to use...
  15. S

    TransferSpreadsheet fails after upgrade to Excel 2010

    I tried saving the excel file in .xls format, but that didn't work either. Eventually, I found the solution elsewhere, so I'm writing this just in case somebody else ever has the same problem. In one of those wonderful "undocumented and irrational microsoft weirdness" moments, it turns out...
Top Bottom