Search results

  1. K

    Check path for errors

    Nice code Ray! Not a function I was really aware of (hence my longer code), but I'm sure I'll have many uses for it now! Thanks. (In case you're wondering, when I started typing my earlier reply there'd been no other replies, which I think is why we have 3 very different answers in a row).
  2. K

    Case Select on subform

    No, I'm afraid you can't do this on a continuous form. Things like the Visible property of a control apply to the control in general. You must remember that whilst the control shows different data for each record, it is still the same control on every record. Sorry, hope you can work around...
  3. K

    Check path for errors

    You can do this using the FileSearch object, but you will need the path to the folder without the file name on the end for this: With Application.FileSearch .NewSearch .LookIn = strFolderPath .SearchSubFolders = False .FileName = strFileName .MatchTextExactly = True...
  4. K

    Continuous form with Conditional Check

    You're right that the calculated control is not updated until after the code runs. One alternative is to add up the recordsetclone values, ie: Private Sub PercentCtrlName_AfterUpdate() Dim Tot As Single DoCmd.RunCommand acCmdSaveRecord Tot=0 With Me.RecordsetClone...
  5. K

    Sum in select query

    Is there a reason that your query thinks your numbers are text? It might be worth investigating to make sure it doesn't cause you other problems. As it stands though, try using the Val function, which interprets strings as numbers if possible, ie: TotalMems...
  6. K

    Question Error - Table already open exclusively

    My best guess is that the DMax function is causing the problem, although it's not one I use much so I can't be sure. One test would be to comment out the lines of code that form the criteria and see if you can just get the forms to close and open properly. If this does work, then try an...
  7. K

    Form Looks up different Query

    You need some code in the OnCurrent event of your main form that tests for being on a new record and filters the dropdown accordingly. Since I don't think you can filter combo boxes, you may have to reset the RowSource each time, eg: Private Sub Form_Current() With...
  8. K

    Automated Compact and Repair

    Try removing the space and see if it works then. I don't about stopping the database reopening though.
  9. K

    Excel Macro - hiding rows

    You need to test for the strings with wildcard characters. Using MyCell as a placeholder for however you're selecting the Column B cells, I think you'll want something like: If MyCell.Value Like "MGM*" Or MyCell.Value Like "BUYER*" Then ... End If This will pick up all cells that start with...
  10. K

    If function won't work when testing for empty combo box

    You've defined RefLoc as a string, therefore it can't be null and you need to test for: If RefLoc = "" (and conversely, If RefLoc <> "") I'd recommend code something like: Private Sub Command3_Click() Dim xlBook As Object, xlApp As Object Dim User As String, GrpNumber As String...
  11. K

    Need to Export Access Report in Excel Format

    I had an error using OutputTo with someone else using my database on a different computer. It turned out that they didn't have the latest Access/Office service pack installed, and once they installed it then it worked fine. Might be worth checking whether you have the service packs or not (I...
  12. K

    Pull through to email if not null

    No problem, glad it worked :-)
  13. K

    Pull through to email if not null

    Fozi, sorry if this is now confusing. Had accidently posted before finishing writing the post - bad habit of hitting Tab when writing code to indent it, which doesn't work on forums! So deleted unfinished posts and posted complete code, but obviously not til you'd started writing your reply...
  14. K

    Pull through to email if not null

    Ideally you want to create a loop that will run through the required controls. There are several ways to do this. Here's a possible bit of code... Dim CtrlsToUse As Variant, Ctr As Byte CtrlsToUse = Array("1aC", "1bC", "2aC") stDocBody = "" For Ctr = 0 To CtrlsToUse.UBound -1 If Not...
  15. K

    Question Design of a database

    If ever you feel you need 'subrecords' then what you actually need is a new table. I would recommend storing the 'precautions' info in a separate table. Patients:Precautions will be a 1:Many relationship. The precautions table will contain the info about the ward and dates specific to that...
  16. K

    Need Input Box and then Reference value entered

    I assume you have a specific event for this to go in... The InputBox function has these arguments: InputBox(Prompt As String, Title As String, DefaultValue, several other arguments to do with position etc) Dim Ans As String Ans = InputBox("Please enter [whatever it is you're asking...
  17. K

    Quota control in a form

    Excellent, glad to hear it :-)
  18. K

    difficulties with forms and subforms

    For starters, the two fields: owner's home town (lookup in table) owner's home county (lookup in table) ...should really be in the Owners table, since they apply to the owner, not the deed.
  19. K

    Exit do at Bookmark

    Could do with a bit more info for this. If it's a type mismatch that implies that Access isn't recognising your variable as a bookmark. Do you have a line before your "Do": Dim varbookmark As Bookmark ...and also a line setting varbookmark to a valid bookmark?
  20. K

    Runtime error 91

    Actually, having looked through again I think I've spotted your problem. The red line should be: J = objWrkBk.ActiveSheet.UsedRange.Rows.Count I think. Possibly: J = objxls.ActiveSheet.UsedRange.Rows.Count ...can't remember if ActiveSheet is a method/property of the application or the...
Back
Top Bottom