Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2006
    Posts
    6

    Unanswered: A form combining 2 tables (not a subform)

    Hi everybody,
    Let's say that I've got a table "tblCustomers" with a "IdCust" field, a "deliveryaddress" field which is usually the bill address too. But for some customers there is a different one. To deal with these occasionnal cases, I've got a 2nd table "tblOtherBillAdr" with the fields "IdCust" and "billaddress". What I've done until now is form using the "tblcustomers" where appears by default the "deliveryaddress" which will be the bill address. For the customers having a different bill address, how can I have my form displaying the right address? Thanks in advance for your expertise (I'm just a newbie)
    Thierry

    PS: I'm using ms access 2003
    Last edited by thierry.drouet; 06-05-06 at 07:41.

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372

    Hello thierry!

    Look at "DemoBilladdressA2000.mdb",
    Look at "Table1", "Table2", "Query1", open "Form1".
    Attached Files Attached Files

  3. #3
    Join Date
    Apr 2006
    Posts
    6
    Thanks MStef-ZG for your reply with example. It's nearly what I need. How could I now simply have the BillAddress when blanked, filled with the DeliveyAddress? Thanks again ;-)

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Morning, Thierry!

    You don't need a second table for this purpose! Add your BillAddress field to your original table and this code in the Form_BeforeUpdate sub:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If IsNull(Me.BillAddress.Value) Then
    Me.BillAddress.Value = Me.DelAddress.Value
    End If
    End Sub

    If the billing address is left blank the DeliveryAddress will be filled in!
    (This code has been tested and works)
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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