Results 1 to 3 of 3

Thread: VBA : Access forms

  1. #1

    Thread Starter
    Member DrDids's Avatar
    Join Date
    Oct 2002
    Location
    Montpellier, France
    Posts
    33

    VBA : Access forms

    I wrote some code in VBA to be able to select dependent records on a form B
    when I select a record on form A (very classical)

    I worked just after writing it !
    but after closing the general form containing the forms A and B
    It doesn't work anymore !

    what a frustration working with this stuff!

    here is the code
    I don't really which event I should use !

    but Form_current seemed to work! at first

    <code>
    Private Sub Form_Current()
    Form_B.RecordSource = "SELECT * FROM TableB where Valeur='" & codeA & "';"
    </code>

    which lies within the Form_A codes !

    any help welcomed

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    Are you loading form B before form A?

  3. #3

    Thread Starter
    Member DrDids's Avatar
    Join Date
    Oct 2002
    Location
    Montpellier, France
    Posts
    33
    Originally posted by Ephesians
    Are you loading form B before form A?

    Yes ... I mean they are loaded at the same time as A is a principal form and B is a secondary form displayed in A
    but B hasn't got a foreign key pointing to
    referenced in A !

    In fact the .RecordSource attribut is a too strong concept here as the codeA value will be unique in table B !

    What in fact I want to do is to show the unique record in table B corresponding to the value of codeA (notice I can't put a foreign key as the values of the field Valeur in B has got some values which have nothing to do with a codeA ....

    MAy I could put this foreign key anyway !

    My question is there even after solving
    that little problem of foreign key or not !


    ... a bit later

    Do you mean that may be the delay of loading (even is they supposed to be loaded at the same time ) may occur the incorrect "reaction" ... I even experience some crashes sometimes ... without any error message !
    should I test
    if (B.isloaded) then
    form_B.Recorsource..
    kind of stuff?
    Last edited by DrDids; May 1st, 2003 at 05:41 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width