Results 1 to 4 of 4
  1. #1
    ecalvert47462 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    17

    Looking at values in 2 seperate fields in a query

    So I have a user form where someone will select Yes if they have a reference number...and then once they select yes they will enter the reference number in the reference number field.

    Sometimes the user forgets to select Yes, but puts in a reference number anyways.

    I have a report that runs against this query and tells me what has a ref number and what it is.

    What kind of query criteria can I use so that they both show up on the report, ones that are filled in correctly and ones that only have one of the two fields in? I used is not null but that only returns the ones where both fields are filled out.

    Thank you.


    E

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 64bit Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    I might do this a little differently. I would grey out (disable) the reference text control until the control that holds the Yes value is in place. It would require you to do an after update event on that control. In this manner, no reference number can be inserted without the Yes being added.

  3. #3
    ecalvert47462 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    17
    would that be a hard thing to do?

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 64bit Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    No. in the form properties, in the on-load event, set the reference number control to disabled. In the properties for the yes control, in the after update event, indicate an if-then statement that if the control value is Yes, then set the reference number control to enabled.

    See below examples

    Code:
    Option Compare Database
    Option Explicit
    
    
    Private Sub Field5_AfterUpdate()
        If Me.Field5.Value = "YES" Then
        Me.Field1.Enabled = True
        End If
    End Sub
    
    
    Private Sub Form_Load()
    Me.Field1.Enabled = False
    End Sub
    Last edited by alansidman; 09-03-2015 at 11:12 AM.

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

Similar Threads

  1. Replies: 1
    Last Post: 07-09-2014, 06:50 AM
  2. Replies: 5
    Last Post: 04-26-2013, 09:16 PM
  3. Joining two Tables on two seperate Fields
    By Atlascycle in forum Queries
    Replies: 1
    Last Post: 01-23-2013, 09:01 AM
  4. Replies: 1
    Last Post: 12-12-2010, 05:03 PM
  5. Replies: 0
    Last Post: 10-18-2009, 10:44 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