Search results

  1. D

    How to sort alphanumeric strings

    There is another way to attack this problem: Create a sort code based on the field text for the query or table to be sorted by. One of the keys to understanding how to do this and why it works is to first realize that an Access ascending text sort will sort numbers perfectly well but with one...
  2. D

    Order by numbered list "1.2.3"

    How about pre-processing instead of post-processing? IOW, add a sort column to the table so when records are created they have a sort code created as the record is written?
  3. D

    Order by numbered list "1.2.3"

    You need Access to first sort the numbers between the dots by the number of characters between the dots and then by the actual characters between the dots. To do that, one way is to generate a string from the ref value that contains both. Then it should sort "correctly". I use letters to...
  4. D

    Complex query sort

    Why not include a calculated field in the query and sort (ascending) by that calculated field? Iif([tblMyTable].[fldName] <> "Table of Contents", [tlbMyTable].[fldPage], 100000 - [tblMyTable].[fldPage]) or something like that... hth,
  5. D

    Query results in ComboBox

    Does your query have an ORDER BY clause? If so, could you pst the SQL?
  6. D

    Dynamic SQL vs. Custom Query Function

    What I’d like to do is offer the user a search function for strings that may be present in a table field. I can think of two methods for doing this: using a dynamic query statement generated from code; or using a custom function call in a saved query. From reading the experts on this board...
  7. D

    Beginner VBA Needs Help - Text Problem

    This problem can be simplified if the string is searched for spaces from right to left to begin with, as in: Public Function fncGetLstName(ByVal strName As String) As String Dim I As Integer fncGetLstName = strName 'return strName on no spaces in string For I =...
  8. D

    Concatenated field in query

    How about this: In your query, call the function below passing it Col_A and Col_B, as in: ConCat:fncConCat([Col_A],[Col_B]) Function fncConCat(str1 As String, str2 As String) As String '(The MicroSoft 3.6 DAO Object Library reference must be checked...) Dim dbs As DAO.Database Dim rst As...
  9. D

    Need help counting records displayed

    Dim lngRecCnt as Long .... lngRecCnt = Forms("MyMainFormName")("MySubFrmCntlName").Form.RecordsetClone.RecordCount ... hth,
  10. D

    using value of string as criteria

    Remove the criteria from your query. Access will not parse a string into a logical criteria statement. Instead, add a new column to your query as follows: Field: IIf(IsNull([Forms].[frmRapportActiepunten].[SelectId]),True, CBool(InStr(1...
  11. D

    Odd stuff - Overflow Error

    Apologies. You're right: I don't know what I was thinking...
  12. D

    Odd stuff - Overflow Error

    I think so... Type in: Function tst() Dim X as Long X = 12.0 * 10000 Debug.Print X End Function And watch what happens to the code after you run it. It should change to: Function tst() Dim X as Long X = 12# * 10000 Debug.Print X End Function
  13. D

    Odd stuff - Overflow Error

    My guess is that is has to do with the entire statement x = 12 * 10000 because Function tst() Dim x As Long x = 12 x = x * 10000 Debug.Print x End Function works just fine. If I remember from my assembler days (long, long ago and a lot nearer than I like to contemplate), the code had to...
  14. D

    HELP! - How to parse memo field?

    If FieldA can be assured to have at least 2 paragraph delimiters ("%##%%##%"), try this query on your table: SELECT tblMemos.FieldA, Mid([FieldA],1,InStr(InStr(1,[FieldA],"%##%%##%")+8,[FieldA],"%##%%##%")+7) AS Expr1 FROM tblMemo; Note: If FieldA has less than 2 paragraph delimiters, the...
  15. D

    Do while loop not playing the game

    The EOF property doesn't signify the last record position: When true the EOF property signifies the record position is past the last record (mirroring the BOF property which when true means the record position is before the first record, not at the first record). If BOF and EOF are both true...
  16. D

    using arrays in loops.....maybee :)

    Are you trying to match names in different columns (column 1 and column 10) of the same row of the worksheet? Try:Sub TstMacro() Dim I As Integer With Workbooks("MyWorkBook").WorkSheets("MyWorkSheet") For I = 1 To 20 If .Cells(I, 1) = .Cells(I, 10) Then 'Do stuff...
  17. D

    Sorting text field as numeric in report? Please Help

    Do I think it's OK? Most definetly: If it does what you want it to do, how wrong can it be? :) Glad to help. The one thing I would add is that we're using built in features of Access to sort in ways not optimized by Access: We're calculating a text string from given data and then sorting by...
  18. D

    Sorting text field as numeric in report? Please Help

    The expression for SrtFld was just a "brute force" method of adding a field to the query that would sort the report in the desired way. 20 zeros are not necessary. But what is necessary is the maximum number of leading numeric characters present in [House/FlatNumber] for any record in the...
  19. D

    Showing date diff

    Have you tried: =Iif(DateDiff("d",Now(),[Warranty]) <= 0, 0, DateDiff("d",Now(),[Warranty])) and (I'm assuming RW2 is set to above), =IIf([RW2]<=0, "This Equipment is Probably Broken", IIf([RW2] < 14, "This Equipment is About to Break", "This Equipment Isn't Expected to Break For at Least 14...
  20. D

    Make field on subform not visible

    In the appropriate event: Private Sub cmdApply_Click() 'or some such.... If IsNull(Me!MyMainFormControl) Then Me!SbFrmControlName.Form!MyControlNameOnSbFrm.Visible = False End If End Sub hth,
Back
Top Bottom