holding the same field between forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ftm1975
    New Member
    • Aug 2008
    • 1

    holding the same field between forms

    I have a access database where i have a number of different forms and tables but all with a unique identifer of ClientNo. when i move between forms i want the form i open to open in the same ClientNo as the form i was previously in. They are separate forms and separate tables. If the client no does not exist in the 2nd form then i need a message or something to promt the user to enter a new record!!!!!!!!!

    Any suggestions!!!! !!
  • hjozinovic
    New Member
    • Oct 2007
    • 167

    #2
    Hi ffm,

    You can do the same our brain does :-)
    [HTML]Open Form1. On close remember the Client no. (on close event in Form1 store the Client no. from a current record into the Public variable
    Open Form2
    Find a Client no. you remembered (DoCmd.FindFirs t.... look through the Client no. field in Form2 for a value stored in a variable)[/HTML]

    Note: if there is no value you were looking for it will automaticaly give you the prompt!

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32661

      #3
      There are two ways that spring to mind to select records of a form you are about to open in code.
      1. Prepare a filter string then open the form with that string as the WhereClause parameter.
      2. Pass the value of the ID across into the form on open with the OpenArgs parameter.

      Be a little careful of the OpenArgs parameter when trying to access it from within the newly opened form though. If it's not saved as one of the first commands in the code, it will disappear.

      Comment

      Working...