If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
textbox searching?
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- |
#2
|
|||
|
|||
Also tried this, but no results:
Dim conMB As New ADODB.Connection Dim rsCustomer As New ADODB.Recordset Set conMB = New ADODB.Connection Set rsCustomer = New ADODB.Recordset conMB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=V:\QualMgt\DIRS\DIR.mdb" conMB.Open With rsCustomer .CursorLocation = adUseClient .CursorType = adOpenDynamic .LockType = adLockOptimistic .Open "SELECT DISTINCT tblComments.Date & tblComments.Comment FROM tblComments WHERE [DIR]=Forms!frmDIRUpdate!txtDir And Catagory='Investigation'", conMB, , , adCmdText txtCom_In = rsCustomer End With -MK- |
#3
|
|||
|
|||
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- |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
textbox scrollbar disappears | Yaniv | General Discussion | 1 | June 20th, 2005 11:31 PM |
Textbox autofill | Marc Claasen | General Discussion | 0 | May 26th, 2005 01:48 PM |
Macro to print textbox? | Nikki | Powerpoint | 5 | April 25th, 2005 04:11 PM |
Textbox, web browser control, and Unicode (got cutoff) | Mark Johnson | General Discussion | 0 | February 12th, 2005 02:08 AM |
textbox used as report parameter | jh | Setting Up & Running Reports | 4 | October 21st, 2004 06:59 PM |