Guest_imported
New member
- Jan 1, 1970
- 0
I'm using ADO to link to an Access 2000 DB. I'm updating numerous text boxes
on a form with info from the DB via a search using the contents of one of
the text boxes entered by the user. I'm also using the following SQL commandtext
with variables for the field name(s) and Where parameter:
adoJobProfile.RecordSource = "select fldJobNum, fldCaseNum, fldSerialNum
from tblJobProfile where " & strFldName _
& " = '" & strSearch & "'"
If I enter a value in the text box (e.g., job number) that IS in the database,
everything updates just fine. If I enter a value that IS NOT in the database,
however, the check boxes on the form change to gray checks (should be empty)
and no error message is generated (via Msgbox) which is what should happen.
Also, I can no longer search for a valid job number until I restart the
program. I'm using the following selection structure just after the SQL
statement to display the "Invalid Entry" message.
If adoJobProfile.Recordset.Fields(strFldName) <> strSearch Then
intCount = 0
For intCount = 0 To 22
chkPart(intCount).Value = 0
chkPart(intCount).Enabled = False
Next intCount
txtInstr.Enabled = False
intRetVal = MsgBox(conMsg, conBtns, "Invalid Entry"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
textbox.SelStart = 0
textbox.SelLength = Len(textbox.Text)
Exit Sub
End If
Obviously not being familiar with ADO or SQL, I'm not sure how to code the
selection structure properly to get the desired result. Any help would be
appreciated.
Thanks,
R.T. Smith
on a form with info from the DB via a search using the contents of one of
the text boxes entered by the user. I'm also using the following SQL commandtext
with variables for the field name(s) and Where parameter:
adoJobProfile.RecordSource = "select fldJobNum, fldCaseNum, fldSerialNum
from tblJobProfile where " & strFldName _
& " = '" & strSearch & "'"
If I enter a value in the text box (e.g., job number) that IS in the database,
everything updates just fine. If I enter a value that IS NOT in the database,
however, the check boxes on the form change to gray checks (should be empty)
and no error message is generated (via Msgbox) which is what should happen.
Also, I can no longer search for a valid job number until I restart the
program. I'm using the following selection structure just after the SQL
statement to display the "Invalid Entry" message.
If adoJobProfile.Recordset.Fields(strFldName) <> strSearch Then
intCount = 0
For intCount = 0 To 22
chkPart(intCount).Value = 0
chkPart(intCount).Enabled = False
Next intCount
txtInstr.Enabled = False
intRetVal = MsgBox(conMsg, conBtns, "Invalid Entry"
textbox.SelStart = 0
textbox.SelLength = Len(textbox.Text)
Exit Sub
End If
Obviously not being familiar with ADO or SQL, I'm not sure how to code the
selection structure properly to get the desired result. Any help would be
appreciated.
Thanks,
R.T. Smith