Search results

  1. J

    DCount stopped working

    Most likley cause is the way access expect dates to bee formatted as in mm/dd/yyyy check this link: http://allenbrowne.com/ser-36.html JR
  2. J

    TransferDatabase method with WHERE condition

    Instead of TransfereDatabase why don't you use a Select Into query to import you data Using the IN clause to specify your other DB. SELECT * INTO MyImportTable FROM MyTable IN 'd:\MyFolder\MyOtherDb.mdb' WHERE Right([BookDate], 4) >= Year(Now) - 1; A more efficient way whould be to use...
  3. J

    First name, last name, Full name field frustrations

    I would do this to avoid a trailing space after the firstname if someone do not have a middleinitial: Fullname: [LastName] & ", " & [FirstName] & (" "+[MiddleInitial]) JR
  4. J

    DBEngine problem

    Thanks for the post Chris, I acutally tested it with that code by setting CurrenDb.Tabledefs and it does work. Perhaps i was being overly cautious by explicitly creating a variable db and setting that to CurrentDb. I usually use CurrentDb to all my code where needed execpt when dealing directly...
  5. J

    DBEngine problem

    I just need to rant a little, I have this little old code which sits innocently smack i the middle of a critical procedure in my db. Public Function GetBEFolder(pTableName As String) As String Dim strFullPath As String Dim I As Long strFullPath =...
  6. J

    Run-Time Error 6 - Overflow

    Oops forgot to remove the perence belonging to you original IIF(), just remove the last perence. =FormatNumber(ExchangeRate([Start Date],Nz([CurrencyID],0),10) Public Function ExchangeRate(DateValue As Date, CurrencyID As Long) As Double 'Returns Exchange Rate for values supplied '-1 returned...
  7. J

    Run-Time Error 6 - Overflow

    Change CurrencyID in you function from Integer to Long, if you pass on a value outside the range -32,768 to 32,767 you get an overflow error. Public Function ExchangeRate(DateValue As Date, CurrencyID As Long) As Double As for trapping NULL you can use Nz()...
  8. J

    Run-Time Error 6 - Overflow

    Its because IIF() evaluates both True and False so your function ExchangeRate() gets called regardless of the value of CurrencyID. You might as well just call the function, but trap the potential overflow error inside your function. JR
  9. J

    Access to save existing Excel workbook as PDF

    Diden't my code work to your expectation? Anyway I think this causes that extra instance of excel. For Each xlWorkSheet In Sheets You need to tie every excel-objects and methodes to one of your declared Excel-objects. try: For Each xlWorkSheet In xlApp.Sheets Also clear out any...
  10. J

    Access to save existing Excel workbook as PDF

    Try this: Function ExportPDF(xlFileName As String, SavePDF As String) Dim objXl As Object Const xlTypePDF = 0 Const xlQualityStandard = 0 Set objXl = CreateObject("Excel.Application") With objXl .Workbooks.Open (xlFileName) .ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF...
  11. J

    Sending Email

    Add another comma. DoCmd.SendObject , , , strEmailAddress, , , stSubject, strEmailMessage JR
  12. J

    Sending Email

    Try: Set rst = CurrentDb.OpenRecordset("Select EMail From tblEmailList Where [uName] ='" & strUser & "'") You need refrence the variable strUser outside of the sql-string. JR
  13. J

    Sending Email

    Instead of opening the hole table just open a selected recordset. Set rst = CurrentDb.OpenRecordset("Select EMail From tblEmailList Where [Type] = 'Super'") or you can pass on to the Sub/Function the parameter so you don't have to have 2 different sub/function. Function MyEmail(SendType...
  14. J

    Numbers, queries and Iif

    Only experience and head against keyboard :banghead: But if you had used the expression wizzard and looked up IIF() then it should have given you a clue on what was required. IIf(«uttrykk»; «sant»; «usant») One word of caution when you want to refrence the forms or Reports-collection, use...
  15. J

    Numbers, queries and Iif

    this runs perfectly for me: SELECT (IIf([tbl].[someNumber]>0,0,100)) AS Performance FROM tbl; But if I try to pase it directly into the querydesigner then it errors out, and the reason is that my language setting is Norwegian and I must use semicolon ";" to seperate parameters in...
  16. J

    E mail problem

    You diden't say where and what the error was, but since this worked before the I might venture to guess that the Office enviroment has changed and you are refrencing the wrong Outlook liberary. You are using Early-binding so switch to Late-binding might help. try this: Private Sub...
  17. J

    Heres a very odd question?

    Could it be this bug: http://allenbrowne.com/bug-16.html JR
  18. J

    Algorithm

    This should be straight forward by using various string-functions and a few Date() functions. First you need to create a Main custom function that accepts 2 parameters namely the fullname and DOB, and also Dim a few holding variables. Function GetLicence(AnyString As String, DOB As Date) As...
  19. J

    Code Won't Run A Second Time

    See here for the reason: http://www.btabdevelopment.com/ts/excelinstance JR
  20. J

    VBA Editor Opening Instead of Running

    sounds like a phantom breakpoint: http://www.access-programmers.co.uk/forums/showthread.php?t=213807&highlight=phantom+breakpoint JR
Back
Top Bottom