A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

textbox searching?



 
 
Thread Tools Display Modes
  #1  
Old August 22nd, 2005, 02:18 PM
-MK-
external usenet poster
 
Posts: n/a
Default 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  
Old August 22nd, 2005, 02:37 PM
-MK-
external usenet poster
 
Posts: n/a
Default

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  
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-

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 12:15 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.