Results 1 to 10 of 10
  1. #1
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145

    Displaying Text on Form Depending on Another Field Box


    Hi Forum,

    Is there a way to build a expression or make a calculated field where a text displays on a form due to another field box that is selected. I have a field for "NCR Detail" that will be selected and automatically the "NCR Code" will be displayed on the Header as illustrated. The relationship with NCR Detail and NCR Code is matched 1:1 on a Table. Not sure how to go about this. Thanks!

    Click image for larger version. 

Name:	Inked1_LI.jpg 
Views:	10 
Size:	69.7 KB 
ID:	29061Click image for larger version. 

Name:	2.png 
Views:	10 
Size:	33.5 KB 
ID:	29062

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    sounds like what you need is in your ncr code textbox put

    =cboNCRDetail.column(1)

    change names to match your names

  3. #3
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    Quote Originally Posted by Ajax View Post
    sounds like what you need is in your ncr code textbox put

    =cboNCRDetail.column(1)

    change names to match your names
    Hey Ajax,

    Thanks for the quick response. I used =cboNCRDetail.column(1) on the NCR text box on "default value" Form View and it comes out to be "=[cboNCRDetail].[column](1)" on the expression builder. This doesn't appear to work. Any other suggestions? BTW the table for the NCR codes and NCR detail is on a separate table by itself. I don't know how they can be linked up.


    Click image for larger version. 

Name:	3.png 
Views:	9 
Size:	38.4 KB 
ID:	29063

  4. #4
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    I was thinking using Dlookup....But was unsuccessful... This is what i tried so far

    =DLookUp("[tblNCRCode1]![Code]","[tblNCRCode1]",[tblNCRCode1]![Description]=[cboNCRDetail])

    Click image for larger version. 

Name:	4.png 
Views:	8 
Size:	68.3 KB 
ID:	29064

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    default value is only applied for new records - it needs to be in the controlsource

  6. #6
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    Ajax,

    This almost worked; It displays the "type" from the above text field but not the actual "code". When I change from "1" to "0" it displays the "details".

    Click image for larger version. 

Name:	6.png 
Views:	8 
Size:	49.2 KB 
ID:	29065Click image for larger version. 

Name:	7.png 
Views:	8 
Size:	59.1 KB 
ID:	29066

  7. #7
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    Here's another picClick image for larger version. 

Name:	8.png 
Views:	8 
Size:	61.1 KB 
ID:	29067

  8. #8
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    it depends on the columns in your rowsource - you haven't provided any information about that - the implication is you wanted pick up the displayed value which is usually column1

  9. #9
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    Thanks Ajax,

    I just used dlookup instead for this.

  10. #10
    raychow22 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    145
    If the field is just a text box then it wouldnt have a rowsource, correct? Id have to use a combobox or list box?

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

Similar Threads

  1. Replies: 1
    Last Post: 03-09-2015, 12:03 PM
  2. Replies: 2
    Last Post: 09-11-2014, 11:37 PM
  3. Replies: 3
    Last Post: 09-02-2013, 04:33 PM
  4. Replies: 5
    Last Post: 08-08-2012, 01:30 PM
  5. Replies: 1
    Last Post: 02-20-2012, 01:02 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