Search results

  1. MarkK

    Query not giving expected multiplication results

    If you need numbers rounded to some fixed count of decimal places, use the Round() function. ? Round(0.195867, 2) 0.2 ? Round(0.046, 2) 0.05 And it works in queries too.
  2. MarkK

    Show a specific field

    If data state affects the presentation of your user interface, you will need to calculate this presentation in two cases, 1) when user changes said data, and 2) when you arrive at a new record. This being the case, it is common practice to perform this presentation logic in a separate method...
  3. MarkK

    Solved Restrict Data Entry

    In your data, how is this "wrongness" identifiable? It seems like a mistake if there is more than one product table.
  4. MarkK

    Solved Combo/List Box Lookup Add Item

    If you set the RowSourceType of a ComboBox or ListBox to "Value List", you can run the AddItem() method to add a row to the list, so you can loop through any enumerable list, and fill the control programmatically that way. If you have multiple columns, delimit column data with a semi-colon...
  5. MarkK

    count query.

    Moving data around in a relational database, as you are experiencing, is a difficulty kind of like paddling upstream. What I would be more likely to recommend is that you use a query to identify problem rows or areas in your existing table, and present your number 4) as queried from source using...
  6. MarkK

    count query.

    I don't understand this overall requirement. You delete 123.1 so you can find areas where 123.1 should exist? Seems to me if you don't do 3), then you don't have to do 4), and then 1) and 2) are pointless, and *poof*, the whole problem evaporates. So I don't get it.
  7. 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...
  8. 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)...
  9. 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...
  10. 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.
  11. MarkK

    Looking for a Big Fat Book!

    The Stand, Stephen King. Post-apocalyptic sci-fi. 1400+ pages.
  12. 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.
  13. 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...
  14. 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...
  15. 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...
  16. MarkK

    Watercooler v political forum

    But you can move threads to appropriate forums.
  17. 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.
  18. 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...
  19. 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...
  20. 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...
Back
Top Bottom