Selasa, 12 Januari 2016

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


I want to throw a popup and set a property when a condition is met during data entry. BUT, the Q_Truck_Types from the SQL statement is blank? 

What I am expecting is, if my RS (recordset) equals Me.TRUCK_TYPE then popup and set the REASON_CODE....  Or is this not how to use a recordset???  Or maybe something else is way off!

Thanks, Rohn

Private Sub UNIT_COMBO_ID_AfterUpdate()

        Dim RS As DAO.Recordset

        Set RS = CurrentDb.OpenRecordset("SELECT MyTruckTypes FROM TRUCK_TYPE")

    If Me.UNIT_COMBO_ID > 0 Then

        Me.TRUCK_TYPE = [UNIT_COMBO_ID].[Column](5)

    End If

    If IsNull(Me![UNIT_COMBO_ID]) Then

        MsgBox "Not a valid Unit ID!", vbOKOnly, "Invalid UNIT Criteria!"


    End If

    If RS.EOF = Me.TRUCK_TYPE Then

        MsgBox ("FIXED MASTER, Reason Code set to 'Work Order Variance'")

        Me.REASON_CODE = "Work Order Variance"

    End If

    Set RS = Nothing

End Sub


Posted by:
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)



Tidak ada komentar:

Posting Komentar