Selasa, 12 Januari 2016

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


I don't see anything in your code relating to "Q_Truck_Types". Also, this line doesn't make any sense.
I'm not sure what the condition is or what you are attempting to accomplish with a recordset. Do you know how to set breakpoints and/or use debug.print to assist with trouble-shooting? If not, they are great tools to learn.
Duane Hookom, MVP
MS Access


Date: Tue, 12 Jan 2016 13:32:48 -0800
Subject: [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: Duane Hookom <>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)



Tidak ada komentar:

Posting Komentar