View Single Post
  #3  
Old August 22nd, 2005, 08:48 PM
-MK-
external usenet poster
 
Posts: n/a
Default

Solved.

Heres the code:


rsMyRS.MoveFirst
Do Until rsMyRS.EOF

If rsMyRS.Fields!DIR = strDIR And rsMyRS.Fields!Catagory = strType Then
txtCom_In.SetFocus
txtCom_In.Text = txtCom_In.Text & rsMyRS!COMMENT
Exit Do
Else
rsMyRS.MoveNext
End If
Loop

If rsMyRS.EOF Then
MsgBox "No Data Found", vbOKOnly
End If

cheers!

"-MK-" wrote:

Hi there,
I am currently trying to use a textbox to display some data that should be
pulled from a table.
I want to be able to "query" the data that will be displayed in the textbox,
and I was wondering if anyone could point me in the right direction.

This is what i have tried so far, but no results.
Dim dbMyDB As New ADODB.Connection
Dim rsMyRS As New ADODB.Recordset
Dim strTablename As String

dbMyDB.Open "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data
Source=V:\QualMgt\DIRS\DIR.mdb"
strTablename = "tblComments"
rsMyRS.Open strTablename, dbMyDB, adOpenKeyset, adLockOptimistic,
adCmdTable

txtDir.SetFocus
rsMyRS.Find "DIR=" & txtDir.Text & "CATAGORY=" & "Investigation"
txtCom_In.SetFocus
txtCom_In.Text = rsMyRS!COMMENT


I want to "query" what i pull from the table by DIR and CATAGORY
- is there a way to make a text box searh by RowSource?

the row source would be -
SELECT DISTINCT tblComments.Date & " " & Comment FROM tblComments
WHERE [DIR]=Forms!frmDIRUpdate!txtDir And Catagory="Investigation";


Thanks.
-MK-