Senin, 18 Januari 2016

[MS_AccessPros] Re: Can't figure out my RS is blank

 

Thanks for the responses Duane and Liz!


I ditched the idea of trying to pull a record set from a table to compare to a value on the form!

So I am going back to using DLOOKUP to compare a field on the form with a value in another table and if they match, then... throw a message and set a certain Reason Code.

For Duane, I tried the debug.print, seems like I am not getting the results in the DLOOKUP from the table.  And the Me![THE_TRUCK_TYPE] is getting the right data from the field on the form.

Here is my revised code:

Private Sub UNIT_COMBO_ID_AfterUpdate()
Dim MyTruckTypes As String
Dim THE_TRUCK_TYPE As String
    If Me.UNIT_COMBO_ID > 0 Then
        Me.THE_TRUCK_TYPE = [UNIT_COMBO_ID].[Column](5)
    End If
    If (DLookup("[MyTruckTypes]", "[dbo_TRUCK_TYPE]", "[MyTruckTypes]= '" & Me![THE_TRUCK_TYPE] & "'")) Then
        MsgBox ("FIXED MASTER, Reason Code set to 'Work Order Variance'")
        Me.REASON_CODE = "Work Order Variance"
        Me.COMBOPART_ID.SetFocus
    End If
End Sub


Structure of  dbo_TRUCK_TYPE table:
ID = AutoNumber
MyTruckTypes = Text

Thanks again, Rohn

__._,_.___

Posted by: reverson@maintainer.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)

.

__,_._,___

Tidak ada komentar:

Poskan Komentar