Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    3

    Question Unanswered: How to auto add info in new form

    Hello,

    I have two forms: Form 1 holds basic client info (name address etc). Form 2 holds info specific to each time we meet (sessions info). Each client gets assigned a unique Client ID in Form 1 (my own ref ID and not primary key)

    So each client has just one record in Form 1, but multiple records in Form 2.

    Question: How can I get Access to automatically carry over the Client ID from Form 1 to Form 2 so it is there when I click 'add new session' button?

    So I have the Client information entered into Form 1, click on the button I created to add new session info (go to Form 2), but I would like the Client ID field in Form 2 to be automatically entered in Form 2 as I have just assigned it in Form 1!

    Wow, hope some of you can understand that with all the form 1 / form 2 mentions!

    Thanks in advance for helping this Access Amateur!

    Henry

  2. #2
    Join Date
    Feb 2004
    Location
    Houston, Texas
    Posts
    45
    How about using the the openargs param on the OpenForm?

    DoCmd.OpenForm formname[, view][, filtername][, wherecondition][, datamode][, windowmode][, openargs]

    and then in form 2 use me.openargs to view it.
    ...rtk

  3. #3
    Join Date
    Feb 2004
    Posts
    3

    thanks

    At the moment that looks a bit beyond me, but I will search around in the DB and see if I can use your comments. (I am just a basic user). It looks like the code I see in the VB editing area (a language I know nothing about!

    So there's no chance I can achieve this simply by adding a link relationship with an auto update type feature??? (ever hoping for the simple path!).

    Thanks for your message and I'm I will be able to use it in time!

    henry

  4. #4
    Join Date
    Feb 2004
    Location
    Houston, Texas
    Posts
    45
    Yes, you need to know a little (very little) VBA to use my suggestion.
    All you have to do is add the code to the click event that opens form2... something like this:
    Private Sub cmdOpenForm2_Click()
    DoCmd.OpenForm , "frmForm2", , , , , "ClientNumber"
    End Sub

    on the open event of Form2 you could set a text box to the client number with code like this:

    Private Sub Form2_Open(Cancel As Integer)
    Me.txtClientNumber.Value = Me.OpenArgs
    End Sub

    It aint rocket science and I think it will do what you are trying to do.
    ...rtk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •