Docmd.RunSql does not return any recordset. Therefore "rstWork_Order.EOF" is always "True".
You should open the recordset than check EOF. Like...watch for word wrap.
rstWork_Order.Open "Select * from SYSADM_WORK_ORDER where WORK_ORDER_ID = " & strWO_ID, CurrentProject.Connection,adOpenDynamic,adLockOptimistic
blnExist = rstWork_Order.EOF 'check True or False MsgBox blnExist 'False if exist, True if None.
How did you get it to work without openning the record? I mean "rstWork_Order. EOF", is there any code in the form with this recordset object that is still not close?
MNJoe wrote:
[Quoted Text] >strWO_ID = Trim(Me.Work_Order_ID.Text) >'MsgBox strWO_ID >strSql_Statement = "Select * from SYSADM_WORK_ORDER where WORK_ORDER_ID = " >& strWO_ID > >' had the DoCmd.RunSql and it always came back with true for EOF ?? >' even if I hard coded into the Sql Statement a valid Work Order ID > > blnExist = rstWork_Order.EOF > > MsgBox blnExist > > rstWork_Order.Close > Set rstWork_Order = Nothing > > >End Sub >
-- Please Rate the posting if helps you
Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1
|