Search results

  1. MarkK

    FYI

    But another thing: Me (in this context) and Screen.ActiveForm are UI elements, and there's not a lot of UI operations requiring 10 million iterations. If you perform either of these operations once, or maybe even five or eight times, which is what you would do presenting your UI, the time...
  2. MarkK

    FYI

    I think this is a fairer test... Private Sub timeTest() Const MAX_L As Long = 10000000 Dim i As Long Dim clock As Single Dim frm As Form clock = Timer For i = 0 To MAX_L Set frm = Me Next Debug.Print "Using Me: ", Round(Timer - clock, 6)...
  3. MarkK

    How to return null when summing values that include nulls

    If you want more help, show your exact code/SQL etc... Remember, if in a particular row a field like [MyColumn] is null, then the boolean expression "[MyColumn] Is Null" evaluates to -1 (True) for that row. If we then Sum() that expression, we get a (negated) count of null rows. The...
  4. MarkK

    Resize a control on a continuous form

    Any property of a control you set in a continuous form affects all rows. What might make more sense is to show the current row in the header or footer, and make it available for editing/formatting/size-changing in that context.
  5. MarkK

    Looking for a Big Fat Book!

    The Stand, Stephen King. Post-apocalyptic sci-fi. 1400+ pages.
  6. MarkK

    How to return null when summing values that include nulls

    You can also do this... SELECT IIf(Sum([MyColumn] Is Null), Null, Sum([MyColumn])) AS MyColumnSum FROM tMyTable; If one or more rows have nulls, this expression: Sum([MyColumn] Is Null) is true, so return a Null, otherwise return the complete sum.
  7. MarkK

    Creating stock balance by month

    A table should store a type of thing. Maybe you have a Person table, or Transaction, Job, WorkOrder, SalesOrder, Product, Customer, or Patient, names that describe a type of thing. Table names like DataEntry, DispensedQuantity, InventoryAddition, ItemCode, don't make sense because they do not...
  8. MarkK

    OpenArgs

    You can do this... Private Sub Form_Open(Cancel As Integer) If IsNumeric(Me.OpenArgs) Then GoToID CLng(Me.OpenArgs) Else DoCmd.GoToRecord , , acNewRec End If End Sub ... so if you pass a valid numeric ID in OpenArgs, it navigates to that row, else it adds a row. But...
  9. MarkK

    DB behavior is bizarre

    Riffing off your code, if you broke it out into subroutines, you could do it like this... Sub SilenceTimers() Dim frm As Form For Each frm In Forms SilenceAll frm Next frm End Sub Private Sub SilenceAll(frm As Form) SilenceFormTimer frm SilenceSubformTimers...
  10. MarkK

    Watercooler v political forum

    But you can move threads to appropriate forums.
  11. MarkK

    DB behavior is bizarre

    You can also try changing the font and see if that makes a difference. Some fonts don't seem to calculate their spacing correctly, and it's like the insertion point is not where you think it is. You type, and the characters are not inserted into the string where you expect.
  12. MarkK

    Export works, but spec not in MSysIMEXSpecs list

    CurrentProject.ImportExportSpecifications is an object in your database. You just type it in, and *poof*, you are there. Sub ShowIMEXSpecs() Dim spec As ImportExportSpecification For Each spec In CurrentProject.ImportExportSpecifications ' *poof* Debug.Print spec.Name...
  13. MarkK

    Export works, but spec not in MSysIMEXSpecs list

    Check out CurrentProject.ImportExportSpecifications, which is a collection of saved ImportExportSpecification objects. To return a member of the collection, you can use its name, or its numeric index. Note that your code declares and assigns a value to a variable FileName, but that value is...
  14. MarkK

    How do I code delete a record from a combo Box with a button

    Just to show some other options... Private Sub DeleteRecord_Click() Dim rsp As VbMsgBoxResult rsp = MsgBox( _ "THIS ACTION DELETES THIS RECORD." & vbCrLf & "DO YOU WANT TO DO THIS?", _ vbYesNo + vbExclamation + vbDefaultButton2, _ "Confirm Delete") If rsp...
  15. MarkK

    Refresh Listbox Query

    I would do the query like this.... SELECT CustomerID, Customer FROM Customers WHERE Customer Like [prm] ORDER BY Customer I would do the code like this... Private qdf_ As DAO.QueryDef Private Property Get qdfMembers() As DAO.QueryDef If qdf_ Is Nothing Then Set qdf_ =...
  16. MarkK

    How to validate 'time' value from Excel spreadsheet

    ChatGPT says you can disable Excel paste options as follows... Disable Paste Options Button: Go to File > Options > Advanced. Under "Cut, Copy, and Paste," uncheck "Show Paste Options button when content is pasted." I have not tried it, but I definitely ask ChatGPT a lot of questions.
  17. MarkK

    A day in the life...

    Nice job bookending my day! Sweetness at the start, and now, omg, cuteness to close it out. You're a rich man there NG. Cheers,
  18. MarkK

    How to validate 'time' value from Excel spreadsheet

    Here's one way you can get your sub column... Function GetSubColumn(iCol As Integer, Optional iRow As Integer = 2) As Excel.Range With Sheet1.Columns(iCol) Set GetSubColumn = Sheet1.Range(.Cells(iRow), .Cells(.Cells.Count - iRow)) End With End Function In the With block we...
  19. MarkK

    A day in the life...

    What a sweet post. Not a lot of things outshine the pleasure of my morning coffee, but this... Brilliant. Thanks, Mark
  20. MarkK

    When was my Worker's Last Day Off?

    One approach, write a query like... SELECT DateValue(YourDateTimeField) As DateWorked FROM tClock WHERE EmployeeID = 123 GROUP BY DateValue(YourDateTimeField) ORDER BY DateValue(YourDateTimeField) DESC; Now open a Recordset on that query, enumerate its rows, and the first date you find missing...
Back
Top Bottom