Search results

  1. J

    date range search not working ?

    What's the datatype of your tblemain.Datee column? Is it DateTime? Or is it Text? Also, have you tried running some of this code from SQL view to see if it filters? For example: SELECT * FROM tblmain WHERE Datee BETWEEN #05/01/2009# AND #07/01/2009# Does SQL view filter this kind of code?
  2. J

    renaming external file from within a macro

    I ran into a similar problem (a file lock) writing code in Visual Basic .Net. My own solution (don't know why it worked) was to flash up a popup form and immediately close it. Then someone gave me this code as an alternative (which also worked, but again I don't understand it)...
  3. J

    renaming external file from within a macro

    Must it be an EXE file? Here's a simple vbscript (just paste it into Wordpad and then rename the saved file with .vbs extension): Dim fso SET fso = CreateObject("Scripting.FileSystemObject") fso.MoveFile "C:\SCONTRIN.INP", "C:\SCONTRINO.INP" Set FSO = Nothing Msgbox "Finished renaming file."
  4. J

    textbox activated

    Keep in mind that "Enabled" and "Visible" are two different things. Maybe you just use "Visible" and don't bother with "Enabled". If Me.TextBoxMain = "3" Then Me.txtbox1.Visible = False Me.txtbox2.Visible = False Me.txtbox3.Visible = True End If
  5. J

    help with my vba code

    But there's no escaping it - you have to put the Next I in a suitable position to avoid compiler errors. Add a Msgbox strWhere to your code and then use control C to copy and paste the strWhere from the Msgbox into this thread. And if it looks incorrect, tell us how you WANT it to look and...
  6. J

    issue with Join

    If you want to return all the offices, the table that has ALL the offices must be in the FROM clause FROM tblAllOffices Generally, the rest of the tables should be left joined (thanks for pointing that out Wayne) to prevent the join from eliminating some of the offices. One approach would be...
  7. J

    Error 3051 encountered

    To help figure out whether the DB isn't corrupt, try doing a compact and repair. If successful, it's probably not corrupt. Then try the DAO code again. Also, I'm not familiar with "openDatabase" as such. I've heard of - Workspace.OpenDatabase - DBEngine.OpenDatabase Therefore be sure to try...
  8. J

    DoCmd.RunSQL strSQL - Slowly killing my brain

    I'm totally lost as to what you're trying to accomplish - how can an "ID" be equal to a Date?
  9. J

    help with my vba code

    By the way, I doubt VBA accepts: Next i I think it prefers: Next
  10. J

    Picking Single Records To Query

    I don't see the problem. You evidently want to begin by filtering the Product table. This is precisely the sort of thing databases are designed for. Typically an Access forms-designer (which I am not) will place a combo box on a form populated with values for the user to choose from, and then...
  11. J

    delete 4 out of 5 records where name field and address field repeat more than 5x

    Going with Method II, it's going to take at least 2 queries. I'm going to ignore addresses because you now say that only the names are repeating. We'll create 2 tables, KeepThese1 and KeepThese2. First query copies one record into KeepThese1 if the customer has 6 or more addresses. SELECT...
  12. J

    delete 4 out of 5 records where name field and address field repeat more than 5x

    There's no SQL command for "moving" a record from one table to another. Instead you have to (Method 1). (1) Copy the record to the second table. (2) Delete the original record. Alternatively you can (Method II) (1) Copy the record to the second table. (2) Copy all remaining records to a third...
  13. J

    delete 4 out of 5 records where name field and address field repeat more than 5x

    If the above query is producing dups, try rewriting it like this: SELECT DISTINCT fullName, addresses, ID INTO final_output FROM ( SELECT possibles.fullname AS fullname, PrepareForDuplicateCheck.addresses, PrepareForDuplicateCheck.id FROM possibles, PrepareForDuplicateCheck WHERE...
  14. J

    delete 4 out of 5 records where name field and address field repeat more than 5x

    Now I'm even more confused. Earlier you said (1) If there are five dups, I only want to keep one of the five records. (2) If there are four dups (or less), keep all the records in that dup set. NOW you are asking me to eliminate ALL dups ???
  15. J

    Totalsum query is working but...

    Try this: SELECT Lag.*, Deltagere.*, TeamWeights.* FROM ((Lag INNER JOIN Deltagere ON Lag.ID=Deltagere.LagID) INNER JOIN (SELECT Lag.Lagnavn, Sum(Deltagere.Vekt) AS TotalVektLag FROM Lag INNER JOIN Deltagere ON Lag.ID=Deltagere.LagID GROUP BY Lag.Lagnavn) as TeamWeights ON TeamWeights.Lagnavn...
  16. J

    Time calculations

    Huh? 3 times? Start time (say 5 pm) finish time (say 6 pm) Downtime (say 7 pm) ???? Maybe what you mean is two times, plus one quantity of time (i.e. amount of downtime). Your total time would then be the DateDiff (from start to finish) in minutes minus your downtime in minutes. You...
  17. J

    the expression OnClick...error

    Here's something worth trying. On the user's machine go into the vba editor and choose Debug > Compile. Hopefully the compiler will highlight the line of code causing the error. Did you add any UDFs? If so, the problem is likely a lack of sandbox mode on the user machines. You can turn on...
  18. J

    delete 4 out of 5 records where name field and address field repeat more than 5x

    Every table should have a primary key, meaning a unique ID distinguishing each row from the other rows. Therefore I'm not sure why you have duplicate IDs. Sounds like you did not set up your tables correctly. You should run the following code on your tables to fix this problem. ALTER TABLE...
  19. J

    delete 4 out of 5 records where name field and address field repeat more than 5x

    I tested this (on the sample already uploaded) so it should work ok. SELECT F.* INTO KeepThese FROM [The Final Query] as F INNER JOIN ( SELECT Min(F.ID) AS ID FROM [The Final Query] as F GROUP BY names_1, addresses HAVING COUNT(*) >=5 UNION ALL SELECT ID FROM [The Final Query] as F INNER...
  20. J

    Adjusting SQL to accommodate apostrophe

    True, I realize now I overstated the point. Fair enough.
Back
Top Bottom