[AccessD] Should be easy problem to fix

paul_lifopro paul_lifopro at cox.net
Thu Apr 17 09:09:41 CDT 2008


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

 

 

 

 




More information about the AccessD mailing list