[AccessD] Should be easy problem to fix

paul_lifopro paul_lifopro at cox.net
Thu Apr 17 10:30:46 CDT 2008


Andy,

Thanks...that worked great...

Paul

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
Sent: Thursday, April 17, 2008 10:18 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Should be easy problem to fix

Hi Paul
If I've understood you right you just want to stay on the current control if
the compare fails. If that's the case then move your code to the
BeforeUpdate, put a line of Cancel = True after the message and remove the
SaveRecord and the other stuff. The Cancel will make it just stay there.

-- Andy Lacey
http://www.minstersystems.co.uk 

>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com 
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of paul_lifopro
>Sent: 17 April 2008 15:10
>To: accessD at databaseadvisors.com
>Subject: [AccessD] Should be easy problem to fix
>
>
>I have a text box on a form that I want to compare what is 
>entered to a value in a field in a table.  This part works fine.
>
> 
>
>What I'm having trouble doing is setting focus to this same 
>text box and leaving the AfterUpdate event.
>
> 
>
>It always goes to the next text box.  Below is the code I'm 
>using (all variables are declared but I didn't put that code in here).
>
> 
>
>' check to see if the printer supports the # of colors entered.
>
>    SQLstr = "SELECT  * " _
>
>                & "FROM Printer_Costs " _
>
>                & " WHERE (Printer_Costs.Printer_ID) = " & "'" 
>& Me.cboStock_Printer1 & "'" _
>
>                & " ORDER BY Printer_Costs.Printer_Costs_ID;"
>
>   
>
>    
>
>    
>
>    
>
>    Set rs = CurrentDb.OpenRecordset(SQLstr)
>
>    rs.MoveFirst
>
>    If Me.frmStock_Side2_Ink_1 > rs.Fields(16) Then
>
>        MsgBox "This printer only supports " & rs.Fields(16) & 
>" colors. Please make corrections! "
>
>        rs.Close
>
>        Set db = Nothing
>
>        DoCmd.RunCommand acCmdSaveRecord
>
>        Me.frmStock_Side2_Ink_1.SetFocus
>
>        Me.frmStock_Side2_Ink_1.SelStart = 0
>
>        Me.frmStock_Side2_Ink_1.SelLength = 10
>
>        GoTo ExitSubroutine
>
>    End If
>
> 
>
>    rs.Close
>
>    Set db = Nothing
>
>OTHER CODE BELOW HERE..
>
> 
>
>ExitSubroutine:
>
> 
>
>End sub
>
> 
>
>Thanks for your help
>
> 
>
>Paul
>
> 
>
> 
>
> 
>
> 
>
>-- 
>AccessD mailing list
>AccessD at databaseadvisors.com 
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com
>
>



-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list