Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Coordinate 2 forms (Access 2000)

    In my form i have a rather complicated function placed in the OnClick events of different combos and
    list boxes.This function opens a form called FrmCheckOffers, and checks whether
    a client has an offer, i.e if the control Offerid.Value is Null, the client has no offer
    and in this case i make visible the control CmdOffers in my main form.
    My function works, but one sees the closing and the opening of the forms and is a bit heavy.
    And i am sure this is not the best solution.
    I want to use the property Visible = True or False, but how can i coordinate the clientid in the two

    forms? May be the solution is to coordinate the ClientID in both forms without opening the form
    each time i choose a new client from the combo box,but i dont know how.




    Private Function CheckOffers()
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "FrmCheckOffers"
    DoCmd.OpenForm stDocName, , , "ClientID = " & Me.Clientid
    If Forms!FrmCheckOffers!offerid.Value = Null Then
    DoCmd.Beep
    DoCmd.Close acForm, "FrmCheckOffers"
    Else
    Me![CmdOffer].Visible = True
    DoCmd.Close acForm, "FrmCheckOffers"
    End If
    End Function

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Coordinate 2 forms (Access 2000)

    You don't need to open a form to check whether the client has an offer or not; you can check this directly in the table, for example by using the DLookup function.

    I am confused by your description. You state
    <hr>if the control Offerid.Value is Null, the client has no offer
    and in this case i make visible the control CmdOffers in my main form.<hr>
    but in your code, you set Me![CmdOffer].Visible = True in the Else part

    Private Function CheckOffers()
    Me.cmdOffer.Visible = IsNull(DLookup("OfferID", "tblSomething", "ClientID = " & Me.ClientID)
    End Sub

    where tblSomething is the name of the table containing the ClientID and OfferID fields.

Posting Permissions

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