Reuse data from previous record to populate same fields on form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • liimra
    New Member
    • Aug 2010
    • 119

    #16
    Alright

    Regards,
    Ali

    Comment

    • Bigdaddrock
      New Member
      • May 2010
      • 67

      #17
      It works!!! Thank you for all your patience!!
      I really appreciate it!!!

      Comment

      • liimra
        New Member
        • Aug 2010
        • 119

        #18
        You are most welcome. Glad it worked.

        Regards,
        Ali

        Comment

        • Bigdaddrock
          New Member
          • May 2010
          • 67

          #19
          Hope you don't mind but I am having a problem doing a similar Macro, but am getting a syntax error.
          Here is the Expression:
          DLookUp("INVNUM ","INVOICE" ,"[ LatestRevisionD ate] = " & DMax("LatestRev isionDate","INV OICE"))
          The only difference from the successful (thanks to you) expression:
          DLookUp("BFNAME ","REGISTER ","[REGID] = " & DMax("REGID","R EGISTER"))
          Is that REGID is a number, where LatestRevisionD ate is a Date/Time DataType with a General Date format.
          Any suggestions as to how I might alter my expression?
          Thanks

          Comment

          • liimra
            New Member
            • Aug 2010
            • 119

            #20
            Solution/

            Of course I don't - You are most welcome. Yes as stated before you need different context so it becomes:


            Code:
            DLookUp("INVNUM","INVOICE","[LatestRevisionDate] = #" & DMax("LatestRevisionDate", "INVOICE") & "#"))


            Regards,
            Ali

            Comment

            • Bigdaddrock
              New Member
              • May 2010
              • 67

              #21
              Unfortunately, I once again got a syntax error. Any further suggestions?

              Comment

              • colintis
                Contributor
                • Mar 2010
                • 255

                #22
                Did you changed anything and get the syntax error? or it just suddenly pops the error with no reasons?

                Comment

                • Bigdaddrock
                  New Member
                  • May 2010
                  • 67

                  #23
                  No changes to my original input. I copied and pasted your suggestion and got that response.

                  Comment

                  • colintis
                    Contributor
                    • Mar 2010
                    • 255

                    #24
                    Sorry I'm not liimra whose giving you the code. :)

                    Is the date format the same as recordset you are getting from? Error may occurs if the date format are different. So just in case the you can add format() to the code.
                    Code:
                    DLookUp("INVNUM","INVOICE","[LatestRevisionDate] = #" & [U]Format([/U]DMax("LatestRevisionDate", "INVOICE")[U], "mm/dd/yyyy")[/U] & "#"))
                    Just double check the formatting of the source, and change the "mm/dd/yyyy" to the once it matches.

                    Comment

                    • malcolmk
                      New Member
                      • Sep 2010
                      • 79

                      #25
                      To reuse last input could you not just assign the value of entered fields to variables when you exit that control, then have a command button which when clicked cycles through controls assigning saved variables? each time the form is filled in you get a new set of variables and simply clicking command button on next form entry populates form with valuse from previous entry?

                      Comment

                      • Bigdaddrock
                        New Member
                        • May 2010
                        • 67

                        #26
                        There is only one "LatestRevision Date" involved in the following expression that you suggested.

                        1. DLookUp("INVNUM ","INVOICE" ,"[LatestRevisionD ate] = #" & DMax("LatestRev isionDate", "INVOICE") & "#"))

                        Remember, I am seeking the INVNUM associated with the greatest value of the "LatestRevision Date" in the INVOICE Table.
                        Is it possible that the DMax function will not work with a record that is in the General Date format? If not, what similar function is available to do the same thing? Perhaps something like DLAST??
                        Thanks for your ongoing assistance.

                        Comment

                        Working...