Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    395

    Unanswered: How to find the value in a field

    What I am trying to do is when a work order is selected @ the subform and the user clicks on a button a history form opens up with the records for that work order. If the no previous records found for the order a message pops up.

    I’m having trouble to get the If statemtent working. I am trying to check if there is a value in work_ord_num column in the history form that matches the value passed in from the subform.

    “If work_ord_lookup = Me!work_ord_num Then”

    What it is doing is comparing the value from the subform with the previous filtered value in the history form.

    The history form is bound to W_O_History table.
    I'm using in Access FE and SQL Serving as BE.

    Private Sub Form_Open(cancel As Integer)
    Dim work_ord_lookup As String
    Me.ServerFilterByForm = False 'clear all filter criteria in the Server Filter By Form window

    If Not IsNull(Me.OpenArgs) Then
    work_ord_lookup = Me.OpenArgs
    Else
    Exit Sub
    End If

    ‘’’’’’’’’’problem here. Need to fix the code or something’’’’’’’’’’’’’’’’’’
    '''work_ord_lookup is the value from the subform
    '''Me!work_ord_num is a field on the history form

    If work_ord_lookup = Me!work_ord_num Then
    Me.ServerFilter = "work_ord_num = '" & work_ord_lookup & "'"
    DoCmd.ApplyFilter , "work_ord_num = '" & work_ord_lookup & "'"
    Else
    MsgBox "There are no shipments found for Work Order Number: " & work_ord_num & " ", vbExclamation
    End If

    End Sub

    Thank you much!

  2. #2
    Join Date
    Dec 2002
    Location
    Prιverenges, Switzerland
    Posts
    3,740
    i don't use filters, so maybe i'm lost too, but:

    ‘’’’’’’’’’problem here. Need to fix the code or something’’’’’’’’’’’’’’’’’’
    '''work_ord_lookup is the value from the subform
    '''Me!work_ord_num is a field on the history form

    If work_ord_lookup = Me!work_ord_num Then
    Me.ServerFilter = "work_ord_num = '" & work_ord_lookup & "'"
    DoCmd.ApplyFilter , "work_ord_num = '" & work_ord_lookup & "'"
    ...looks wrong.

    you have to tell A which form you are talking about if it's not in the local space of Me.

    i don't know which form "owns" your code, but all other forms need the full blah blah:
    forms!thisBossForm!thatSubForm...etc

    izy

  3. #3
    Join Date
    Dec 2002
    Location
    Prιverenges, Switzerland
    Posts
    3,740
    okokokok i see the openargs. [ctrl][alt][del]

    izy

Posting Permissions

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