Selasa, 12 Januari 2016

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

 

Rohn,
 
I don't see anything in your code relating to "Q_Truck_Types". Also, this line doesn't make any sense.
 If RS.EOF = Me.TRUCK_TYPE Then
 
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

 

To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
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!"
        Me.UNIT_COMBO_ID.SetFocus
    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 <duanehookom@hotmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

.

__,_._,___

Tidak ada komentar:

Poskan Komentar