Get Line Number ()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • petemul
    New Member
    • Oct 2007
    • 10

    #16
    Originally posted by nico5038
    Hmm, when you want to solve this without code you could use a query with the DCOUNT() function like:
    Code:
    select Dcount("ID","query_of_subform","POnumber=" & [POnumber] & " AND [ID} <=" & [ID]) as LineCountPO, POnumber, ID, .... from tblPurchaseOrders;
    This will create a linenumber in the query and you can place the [LineCountPO] "straight away" in your subform.

    Nic;o)

    Nico

    Forgive my ignorance but in this example are you wwriting this code in a new module? or in an event procedure or in the query its self?

    To be honest I think I should just forget this as I think my serious lack of programing skills may be wasting your time!

    I think I need to go and have some training as opposed to self taught

    Thanks

    PT

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #17
      Originally posted by petemul
      What I have done is created GetLineNumber() in a module.
      You didn't, by chance, also name the module GetLineNumber? People often do this, and it confuses the Access gnomes! If you have, you need to rename the module.

      Linq ;0)>

      Comment

      • petemul
        New Member
        • Oct 2007
        • 10

        #18
        Originally posted by missinglinq
        You didn't, by chance, also name the module GetLineNumber? People often do this, and it confuses the Access gnomes! If you have, you need to rename the module.

        Linq ;0)>
        Yes I did - changed it and it works!!!

        Thank you for persistance

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #19
          Glad we finally figured it out!

          Linq ;0)>

          Comment

          • nico5038
            Recognized Expert Specialist
            • Nov 2006
            • 3080

            #20
            Originally posted by petemul
            Nico

            Forgive my ignorance but in this example are you wwriting this code in a new module? or in an event procedure or in the query its self?

            To be honest I think I should just forget this as I think my serious lack of programing skills may be wasting your time!

            I think I need to go and have some training as opposed to self taught

            Thanks

            PT
            My sample is, like posted, purely a query and requires no code.
            The Dcount() function can be used in a query and will give the linenumber because it counts the number or rows for the specified key and only those where the "subkey" is less or equal.

            Good find that modulename linq !
            Hard for me to figure, as I always start my modulenames with "mod" :-)

            Nic;o)

            Comment

            • missinglinq
              Recognized Expert Specialist
              • Nov 2006
              • 3533

              #21
              Unless you teach or spend an awful lot of time in forums like this one, it can be easy to forget the very basic mistakes that many people make. Being in forced retirement, I have the time to contribute here, as well as to four other Access forums, on a regular basis. This is the 4th thread I've seen today where the problem was having the module and function named the same!

              Linq ;0)>

              Comment

              • vdzr
                New Member
                • Mar 2008
                • 1

                #22
                what about the new record?
                what is the iif statement for : don't show a linenumber for a new record?

                I wanted a "x . y" number and changed the textboxcontrols ource to

                =IIf([newrecord]=True;"";GetLij nNr([Form];"PrimIDTstblwo ningen";[PrimIDTstblwoni ngen]) & " . " & Count(*))

                Comment

                • Scott Price
                  Recognized Expert Top Contributor
                  • Jul 2007
                  • 1384

                  #23
                  vdzr,

                  You have asked your question in another member's thread. This is called thread hijacking and is not allowed on this site. There are various reasons for this, the principal of which is that it typically diverts the flow of the thread away from his needs and into yours. Another is that it will tend to mean that your new question is not seen as such, and may get overlooked by many of our experts (You appreciate that they're not looking for answered questions).
                  Please post your questions in their own threads in future (See How to Ask a Question).

                  MODERATOR

                  Comment

                  Working...