Results 1 to 7 of 7
  1. #1
    zerokono is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    8

    Display field value from query in form textbox

    i need a build for ........



    I want to lookup expirydate
    the data is in tblreceipts
    the criteria will be the fields - materialdescription1 & batchnumber (located in tblreceipts)

    I want to put this into a form called frmusage with a textfield called expirydate

    I have tried to use the dlookup function but keep coming unstuck, please help me i'm going insane!

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    What have you tried so far?

    Dlookup("expirydate",tblreceipts","[materialdescription1] = 'MyDescription' AND [batchnumber] = 'Batchw3w2'")

    This assumes Material and Batch are text fields.
    You would replace them with form controls by concatenating them;

    Dlookup("expirydate",tblreceipts","[materialdescription1] = '" & Me.MyDescriptionControlName & "' AND [batchnumber] = '" & Me.MyBatchNumberControlName & "'")
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    zerokono is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    8
    Hi, ive tried everything (including the kitchen sink!). the batch is text but the material is a lookup from a table called `inventroy'

    Cheers

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Okay - please show us what you have tried. The control source or VBA.
    And possibly paste up a picture of your inventory table.

    Are you looking up the inventory name or is there a Primary Key autonumber being used in the combo for it? (I'm assuming it's a combo?)
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    If you are using table lookups (bad bad idea) then you need to use the actual value stored, not what you see.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    zerokono is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    8
    i put it in control source but have deleted it. below is a snapshot of my inventory and receipts tables. The actual inventory table are just textboxes but in the receipts table it is a combobox.

    Click image for larger version. 

Name:	IMG_3477.jpg 
Views:	19 
Size:	198.4 KB 
ID:	46201Click image for larger version. 

Name:	IMG_3478.jpg 
Views:	19 
Size:	165.6 KB 
ID:	46202

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Yes, table lookups. You need to find what the ID is for that entry and use that when you lookup the field in the table.
    Best to get rid of them now.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. AutoFit Text size to display in a form textbox
    By QA_Compliance_Advisor in forum Programming
    Replies: 6
    Last Post: 08-08-2015, 05:00 PM
  2. Replies: 14
    Last Post: 02-06-2014, 11:59 AM
  3. combo box display field name on textbox
    By ultra5219 in forum Access
    Replies: 4
    Last Post: 05-21-2013, 02:43 PM
  4. Display Query field in form?
    By Ray67 in forum Queries
    Replies: 17
    Last Post: 06-01-2012, 12:44 PM
  5. Replies: 5
    Last Post: 08-11-2011, 05:38 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
  •  
Other Forums: Microsoft Office Forums