Results 1 to 10 of 10
  1. #1
    vkumar is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    30

    Need Help With Access Form

    I have a Data entry Form to enter the payment info. I have Invoice ID and Invoice amount etc... in Invoice Table. I want the Invoice amount to appear automatically in the Payment form based on the Invoice Number I enter. I have Invoice number in both tables, Invoice Table(Primary Key) and Payment Table (Foreign Key).


    Thank you for your help.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Simplest would be this:

    BaldyWeb - Autofill

    You can also use DLookup or open a recordset to get the value.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    vkumar is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    30
    I am sorry, I don't know how to use either one of them. I have attached a small sample DB. Could you please tell me how to do it on it. Mine is almost similar to it, just with more fields Thank you.
    Attached Files Attached Files

  4. #4
    vkumar is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    30
    I forgot to create the form to enter payment in the sample DB. The revised DB is attached. Thank you.
    Attached Files Attached Files

  5. #5
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Why do you have the payments in a separate table. I don't see any logical reason when this could easily be in the same table as the invoice. Add a field for pmtDate, pmtAmount.

    Alan

    Edit: Cross Posted at: http://www.access-programmers.co.uk/...d.php?t=240413

    Please read this: http://www.excelguru.ca/content.php?184

  6. #6
    vkumar is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    30
    Like I said the DB is much bigger. The customer wants seperate tables and to run some reports, I need to have seperate tables.

  7. #7
    vkumar is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    30
    I used Dlookup, it didn't work. I changed my field names as oneword using camel case format; InvoiceNumber, InvoiceAmount etc...
    Here is the code I used in my payment form:
    Private Sub InvoiceNumber_AfterUpdate()
    InvoiceAmount = Dlookup ("InvoiceAmount", "InvoiceT", "InvoiceNumber=", & InvoiceNumber)
    End Sub

  8. #8
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Your syntax is not correct.

    If InvoiceNumber is defined as a Number:
    Code:
    Me.InvoiceAmount = Dlookup ("InvoiceAmount", "InvoiceT", "InvoiceNumber=" & Me.InvoiceNumber)
    If it's defined as Text:
    Code:
    Me.InvoiceAmount = Dlookup ("InvoiceAmount", "InvoiceT", "InvoiceNumber='" & Me.InvoiceNumber & "'")

    Linq ;0)>

  9. #9
    vkumar is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    30
    I set the InvoiceNumber as a number field and this is the code I have now.

    Private Sub Invoice_Number_AfterUpdate()
    Me.InvoiceAmount = DLookup("InvoiceAmount", "InvoiceT", "InvoiceNumber=" & Me.InvoiceNumber)
    End Sub

    It's still not working.



    Quote Originally Posted by Missinglinq View Post
    Your syntax is not correct.

    If InvoiceNumber is defined as a Number:
    Code:
    Me.InvoiceAmount = Dlookup ("InvoiceAmount", "InvoiceT", "InvoiceNumber=" & Me.InvoiceNumber)
    If it's defined as Text:
    Code:
    Me.InvoiceAmount = Dlookup ("InvoiceAmount", "InvoiceT", "InvoiceNumber='" & Me.InvoiceNumber & "'")

    Linq ;0)>

  10. #10
    eki einstein's Avatar
    eki einstein is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2013
    Location
    Bekasi - Jawa Barat- Indonesia
    Posts
    26
    Quote Originally Posted by vkumar View Post
    I have a Data entry Form to enter the payment info. I have Invoice ID and Invoice amount etc... in Invoice Table. I want the Invoice amount to appear automatically in the Payment form based on the Invoice Number I enter. I have Invoice number in both tables, Invoice Table(Primary Key) and Payment Table (Foreign Key).
    Thank you for your help.
    are you gona make a partial payment form..? if yes your doing wrong in your table structure... i have revised your database
    sampleok.zip
    Hope those help...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 12-03-2012, 05:28 PM
  2. Replies: 3
    Last Post: 09-06-2012, 09:50 AM
  3. Restricted Access on Access 2010 Navigation Form
    By need_help12 in forum Security
    Replies: 6
    Last Post: 05-02-2012, 10:35 AM
  4. Replies: 6
    Last Post: 02-18-2012, 07:20 AM
  5. Replies: 9
    Last Post: 08-07-2011, 11:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums