Search results

  1. E

    Error Using StrString With SQL INSERT INTO

    Charles, you have added the spaces yourself, consider: strSQL = strSQL & " VALUES(' " & [strcompanycode] & " ', ' " & [strcallreference] & " ', ' " & [strcalldate] & " ', ' " & [strdepartment] & " ', ' " & [strperson] & " ', ' " & [strCallnote] & " ', ' " & [strResult] & " ')" change it to...
  2. E

    %

    you can define a variable as an integer in 2 ways: dim var as integer 'or dim var% in this case, if intcount has already been defined by "Dim intcount as integer", then I suspect that % is not needed. BTW, $ signifies string, # signifies double, & signfies long, ! means single. HTH, Chris
  3. E

    Compile Editor Warning

    In the VBA editor, go to Tools>Options, then under the "editor" tab, untick Auto Syntax Check.
  4. E

    Run time error on SQL

    Just a thought. Is Rst an DAO or ADODB.recordset? try this: Dim rst as DAO.Recordset If you have references to ADO and DAO, it is possible to select the wrong Recordset object in the DIM statement. HTH, Chris
  5. E

    Report Image Based On VBA Path

    hi, I'm assuming the Image is called PicLogo, in which case the syntax is: me.piclogo.picture = strLogo HTH, Chris
  6. E

    Alternative for Access to word with bookmarks?

    you can use a bookmark more than once in Word. Create a bookmark like normal, then if you want to have it somewhere else in the Word doc, just do insert>field and choose Ref from the list. This will bring up a list of bookmark names. simply select your bookmark and click OK. now all you have do...
  7. E

    check table exists

    Try: function TableExists(sTable as string) as boolean dim tdf as tabledef On Error Resume Next set tdf = Currentdb.Tabledefs(sTable) if Err.Number = 0 Then TableExists = True else TableExists = False end if End function or: Function...
  8. E

    I'm stumped with run-time error

    be careful with the find and replace. You don't want to end up with lines like: exit function if instead of end if Chris
  9. E

    I'm stumped with run-time error

    An example may explain things better. Sub sub1() MsgBox "before sub call" Call sub2 MsgBox "after sub call" End Sub Sub sub2() End End Sub The code never gets to the second msgbox. Whereas, if you replace "end" with "exit sub", the code runs as expected. It seems that "end"...
  10. E

    I'm stumped with run-time error

    Where you have used "end" on its own, replace it with "exit function", e.g. If Me(Me.ParamMs & [Param]) = "" Then DoCmd.GoToControl "aa" Me(Me.ParamMs & [Param]) = Null Exit Function End If Do this everywhere, including 'sub' procedures, where you replace it...
  11. E

    Multiple Access versions...ideas on a postcard...

    Hi Matt, I think that you may find the attached file useful. It is a vbscript which you can of course put in a central location and create shortcuts to it. Its purpose is to check the Access version and then open the appropriate DB. It is not intended as an exact solution to your problem but...
  12. E

    Append rows from Excel

    change the db.openrecordset to: db.execute "INSERT INTO BAL (explicitly name fields here) VALUES (AccNum, AdjType, CPS, AdjDesc, Amnt, cn, dispute, cn, auth)" and loop though the rows - is one solution HTH, Chris
  13. E

    Dates in vb/sql criteria (MDY, DMY)

    hi, format dteTestDate as the Access internal number and test against that. Try: SELECT * FROM tblMyTable WHERE SourceDate = " & CLng(dteTestDate) This worked when dteTestDate was a Date variable rather than a string type. If dtetestDate is a string then use CLng(CDate(dteTestDate)). As this...
  14. E

    Quotation mark problem!

    Are you saying that loc1 contains both single and double quotes? Chris
  15. E

    Quotation mark problem!

    try using chr(34) instead.
  16. E

    Pausing until user closes a form

    While the above (Isopen) approach is a very worthy and clever solution, Access will be merrily consume a large percentage of you CPU resources - 50-60% when I was testing it on a 2.4Ghz dual Core machine. Which is unfortunate as it is a neat solution. I would certainly use it in the right...
  17. E

    Connection String In Excel

    Hi Mark, if you are using an ADODB connection object, do this (where conn is the Connection object) or set the connection string: [code] conn.ConnectionString = "DSN=MS Access Database;DBQ=" & thisworkbook.path & "\MCD.mdb; DefaultDir=" & thisworkbook.path & "; DriverId=25; FIL=MS Access...
  18. E

    Changing a string?

    a = Replace(a, "-","_")
  19. E

    Listbox Rowsource - change before opening form

    When you say it does not work, what do you mean? do you get an error mesage or does it simply seem to ignore your settings, or does it put the query name in the listbox? in your Form_Open procedure, you could add: Me.lstresult.rowsourcetype = "Table/Query" If you want people to help, you...
  20. E

    Set value based on combo box selection

    hi Paul, your syntax is all wrong. I'm surprised you did not get a syntax error. Also, which sheet is AG3, using Range("AG3") refers to the active sheet. Try this syntax, which will change cell AG3 of the currently active sheet to the value of cell H7 on Sheet2: Range("AG3").value =...
Back
Top Bottom