| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| I am creating a data entry program that will check a premiumcode from our prmprdtbl before the operator advances to the next text field. I currently have it set up that if the operator types "PRM" into the transactiontype that the application will automatically insert some of the fields for the operator. Private Sub cboTransactiontype_LostFocus() If cboTransactiontype.Text = "NOM" Then cboPaymentType.Text = "NOM" txtTransAmount.Text = "0.00" cmdDESave.SetFocus ElseIf cboTransactiontype.Text = "PRM" Then cboPaymentType.Text = "NOM" txtTransAmount.Text = "0.00" txtTransPremCode.SetFocus End If End Sub However, when I try validating the premiumcode, It doesn't do what I'd like for it to do. Private Sub txtTransPremCode_LostFocus() If rstPremCode.State = adStateOpen Then rstPremCode.Close rstPremCode.Open "select * from prmprdtbl where prmcode = '" & txtTransPremCode.Text & "'", cn If rstPremCode.EOF = True Then MsgBox "You must insert a valid premium code here", vbInformation txtTransPremCode.SetFocus SendKeys "{Home}+{End}" Else txtTransPremCode.Text = UCase(txtTransPremCode.Text) txtTransQty.SetFocus End If End Sub It shows the messagebox even though I haven't advanced past it - or lost focus. It also won't highlight the txtTransPremCode field if I type a code in it that I know doesn't exist in the prmprdtbl. I seriously need some help. Any suggestions would be greatly appreciated. Thank you very much, Angelique |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.