Search results

  1. J

    Ensure releasing/closing of a handle without losing err-state in case

    [dependency injection] ... and nice to test. I like that. It is even nicer with an interface, as you can then separate the methods. Only Create procedure and support methods/properties are visible in the static class, the actual members are available via the interface. Sometimes I feel that...
  2. J

    Ensure releasing/closing of a handle without losing err-state in case

    I like dependency injection, so I like your approach. With New Finalizer(FinalizeProcedure:=...) .FinalizerParameter(0) = CreateFileW(...) DoSomeThingWithFileHandle .FinalizerParameter(0) End With Unfortunately, VBA does not play along so well. We have to make compressions. But I...
  3. J

    Ensure releasing/closing of a handle without losing err-state in case

    Your code looks right to me. The question for me is whether you will still know exactly how to use this structure after a few months ;) Just one question about your intention: why don't you use a class for CreateFileW & Co? Public Sub TestItSub() ... With New...
  4. J

    VBA RecordSet if EOF

    If you remove the fixed data from the recordset, you only need to move the station_id from one record to the next record. strSQL = "select ... from tblStationPerson where move = True Order By order desc" ' .. or no_move = False ... depending on what is correct. ' It would be nice if so much...
  5. J

    Difference between Events and Methods in VBA

    Events can not be called like a procedure - only the event handler. An example: Class with events: Public Event TestEventWithoutParam() '<-- this is an event Public Event TestEventWithParam(ByVal InfoText As String) Public Sub DoSomeThing() ' Raise event TestEventWithoutParam RaiseEvent...
  6. J

    Difference between Events and Methods in VBA

    Perhaps this will help: Please do not confuse event with event handler. Event: an event is triggered, it cannot be called like a procedure/method in VBA. Events in their own classes are triggered in VBA with RaiseEvent. Event handler: this is the method used to react to the event. More (better)...
  7. J

    visible = true is false

    The function shown cannot run. An End If is missing. BTW: The parameter sTable was named this way because you want to pass a form name? ;)
  8. J

    .execute then .openrecordset

    Note: Dim lockedID As Variant ' without set a value to lockedID: Debug.Print "Null: ", IsNull(lockedID), " .. False" Debug.Print "Empty: ", IsEmpty(lockedID), " .. True" Debug.Print "="""": ", lockedID = vbNullString, " .. True" Debug.Print "=0: ", lockedID = 0, " .. True" If the ID is a...
  9. J

    32-bit + 64-bit

    I use Hyper-V on my server. A VM with Office 64bit is running there. (Hyper-V should also be able to be activated on a PC with Win10/11.) I create the 64-bit accde directly from my developer PC using a PowerShell script (New-PSSession).
  10. J

    create initial grey text in a Textbox which disabled when I write in that textbox

    Format property: @;"(insert text)" + Conditional formatting: 1. Has focus: Font ... normal font color 2. Expression: [yourTextbox] Is Null ... font color: grey
  11. J

    .execute then .openrecordset

    The logic with the transaction fits. It should be possible to display a data record before committing. I suspect that the code will not run even without a transaction. The problem will lie in the code blocks that are not shown (where there is currently only pseudo code). Note: However, I would...
  12. J

    DateAdd

    If this is only 1 expression, then it will probably be easy to understand due to the variable names. The 2nd example in #28 reads like this to me: Add [term of contract] - 1 month and then when I read it, the -1 is somewhat pushed away, so that I have to think: "and what is the -1 doing here?"...
  13. J

    DateAdd

    Note: For the readability of the business rule, you could write it like this: = DateAdd("d", -1, DateAdd("m", [terms] - 1, [ctsreleased]) In terms of content, this is the same in Access as: = DateAdd("m", [terms] - 1, [ctsreleased]) - 1 (see #25) With the variant DateAdd(..) - 1, I have to...
  14. J

    Change foreign key

    How do you try to remove them? Update with a value or with Null? What is the advantage of this approach?
  15. J

    Null Delimited with Octothorpes and Null Propagation Returns "Null"

    Why would you expect an empty string instead of Null (text) for the output in the immediate window (<-- only for developer)? I like the output Null as text better than an empty string for Null. In principle, Debug.Print has something similar built in: Public Function MyOwnDebugPrint(byval Value...
  16. J

    Null Delimited with Octothorpes and Null Propagation Returns "Null"

    Whether "#" or "xyz" is used there is irrelevant. "#" is as String. "String" + Null + "String" => Null "String" & Null & "String" => "StringString"
  17. J

    Null Delimited with Octothorpes and Null Propagation Returns "Null"

    Are you possibly interpreting the output via Debug.Print as a return value? Debug.Print always creates a string and converts Null to the string Null. A date is also displayed as a formatted date string. However, this is only the representation of the value as a string.
  18. J

    strSql errors

    SELECT Table1.id, Table1.[T x] FROM Table1 WHERE (((Table1.[T x])="A")); The query editor loves brackets. ;)
  19. J

    Null Delimited with Octothorpes and Null Propagation Returns "Null"

    TestNullVariant should return Null (not the string Null). Simple test: Dim x As Variant x = TestNullVariant() If IsNull(x) Then Debug.Print "x is null .. as expected" Else Debug.Print "x is not null .. ???" End If
Back
Top Bottom