Search results

  1. T

    Can't set focus error or OpenForm action canceled error

    All sorted, thanks for the insight. Micron was on the right track. The frmValidation code was trying to open frmDateSelect, that caused frmChemoRecord to run the AfterInsert code, part of which included the code to open frmDateSelect and later close it which was causing the problem when...
  2. T

    Can't set focus error or OpenForm action canceled error

    Thanks all, I will do a bit of deconstruction to post a bit of the database with the issue, might even come clearer by doing it.
  3. T

    Can't set focus error or OpenForm action canceled error

    Hi All, Apologies for the bad explanation. I have a some code used to test frmChemoRecord, it loops through various scenarios completing the form with a range of different values to test the output. The problem comes when it gets to the DoCmd.OpenForm "frmDateSelect", acNormal, , , ...
  4. T

    Ignore query criteria if form not open

    All sorted with a custom function, great idea Isaac
  5. T

    Ignore query criteria if form not open

    Hi All, I have multiple forms for entering different types of stock onto a database, when entering, a query looks up stock already on the database for that product. To make life simplier I want one query with the criteria for product something like: [Forms]![frmStockEntry].[Product] Or...
  6. T

    Run time error 13 on End Function

    In short and appreciate my explanation might be lacking: There's the 4 variables in the function that come from a form. These create a number of tables based on the different sizes of drug vials available, the function now populates one of those tables using a recodset with the number of the...
  7. T

    Run time error 13 on End Function

    What I was missing was the extra brackets (0), (1) at the end. Thank you buddha I also get the efficiency point I had originally thought that running the function and exporting 4 results would be more efficient as only need to run once but it's just dawned on me that I have to call the function...
  8. T

    Run time error 13 on End Function

    The function runs a lot more code and the end result is the quantities of 4 (or less) vial sizes needed. I need to return those four values to a query so it can be used.
  9. T

    Run time error 13 on End Function

    Hi All, I have a function that I want to export as an array. I've limited the code to the Type Mismatch error Public Function BatchProductionVial1(DrugName As String, DrugRoute As String, DrugDose As Double, DrugBatchSize As Integer) As Variant Dim returnVal(3) As Variant...
  10. T

    Dates Confusion in VBA

    I left out the If Not Isnull( If Not IsNull(DLookup("FirstName", "tblOperatorCode", "DatePart('d',[Birthday])='" & DatePart("d", Date) & "' And DatePart('m',[Birthday])='" & DatePart("m", Date) & "' And [CurrentlyEmployed]=1")) Then I admit it's not great code but it does seem to work and...
  11. T

    Dates Confusion in VBA

    All staff birthdays are in a table tblOperatorCode and not on the form so I need to lookup and see if their birthday day & month matches the current day & month. Your solution with the DatePart got me thinking and I've now resolved it with: If DLookup("FirstName", "tblOperatorCode"...
  12. T

    Dates Confusion in VBA

    Hi isladogs, That datepart seemed a neater solution and works well so thankyou. Can you give your thoughts on my next issue which is looking up if it's someones birthday where I only want to look up the day & month and ignore the year. The sum of my failed attempts has so far been If...
  13. T

    Dates Confusion in VBA

    Hi Grumm, That post solved the issue so many thanks.
  14. T

    Dates Confusion in VBA

    Hi All, I had a bit of code that ran in the run up to Christmas. If Date >= Format("01/12/" & Year(Date), "dd/mm/yyyy") And Date < Format("25/12/" & Year(Date), "dd/mm/yyyy") ThenThis didn't work after the 1st December passed, the solution was Format(Date, "dd/mm/yyyy") >= Format("01/12/" &...
  15. T

    iif statement with query criteria

    Thank you gents, both solutions worked as intended.
  16. T

    iif statement with query criteria

    Hi All, I have a Form frmAuditTrail, it has three combo boxes in the header (Username, Area & Action) What I'm attempting to do is if an Area is selected then I want the Combo box for Action to only list Actions associated with the Area. The difficulty comes when if no Area is select then I...
  17. T

    Continous Form vba changing label

    Many Thanks theDBGuy, All sorted, should have thought of that!
  18. T

    Continous Form vba changing label

    Hi All, I have a continuous form for entering drugs for each drug it has a combobox to select frequency (Day, Week, Month, Year) I would like the result of this field to change the label for just that record. There's a bit of vba that adds and "s" and changes the unbound text box. I did...
  19. T

    Use VBA code to Replace other VBA code

    Thank you both, I think that would work and what Isladogs suggests will be easy to switch on and off.
  20. T

    Use VBA code to Replace other VBA code

    Hi All, In brief I need to press a button that will disable the MsgBox's, then I need the database to run through a large set of test data to check the output. In normal circumstances the operator would be present, but for testing I just need to run the data and review the results without it...
Top Bottom