Solved

Need Code Please

Posted on 2000-04-06
4
626 Views
Last Modified: 2009-12-16
1st>
Sorry, all I have is 69 points..

2nd>
I have an Access mdb with 2 fields
sFileName       text type
sFileDisplay    memo type

I know how to access the database...what I need is
a form with an input box and an sql that will search
throught the sFileNames and find all occurances of the
user's input.

ie.  userinput = textbox

sql finds all occuraces of text or box or any sequencial
combo of the text..ie...extb or tbo or text or box etc.

I then want the sFileNames returned to 1 column of a table
and then the words "View Code" send to the 2nd column with
the words "View Code" hyperlinked to the field sFileDisplay.

I want the sFileDisplay field to display as it is entered...

eg. below:
================================================================
'to read the computer name and registered name of owner.

'  Set A Reference to the "Windows Scripting Host Object Model"
'  copy and paste the following:

Private Sub Command1_Click()

Dim wshShell As New IWshShell_Class
Dim strComputerName As String

strComputerName = wshShell.RegRead _
   ("HKEY_LOCAL_MACHINE\" _
   & "System\" _
   & "CurrentControlSet\" _
   & "Control\" _
   & "ComputerName\" _
   & "ComputerName\" _
   & "ComputerName")

wshShell.RegWrite _
   "HKEY_LOCAL_MACHINE\" _
   & "System\" _
   & "CurrentControlSet\" _
   & "Control\" _
   & "ComputerName\" _
   & "ComputerName\" _
   & "ComputerName" _
   , strComputerName

 MsgBox (wshShell.RegRead _
   ("HKEY_LOCAL_MACHINE\" _
   & "System\" _
   & "CurrentControlSet\" _
   & "Control\" _
   & "ComputerName\" _
   & "ComputerName\" _
   & "ComputerName"))
End Sub

Private Sub Command2_Click()
Dim wshShell As New IWshShell_Class
Dim strWorkGroup As String

strWorkGroup = wshShell.RegRead _
   ("HKEY_LOCAL_MACHINE\" _
   & "System\" _
   & "CurrentControlSet\" _
   & "Services\" _
   & "Vxd\" _
   & "VnetSup\" _
   & "WorkGroup")

wshShell.RegWrite _
   "HKEY_LOCAL_MACHINE\" _
   & "System\" _
   & "CurrentControlSet\" _
   & "Services\" _
   & "Vxd\" _
   & "VnetSup\" _
   & "WorkGroup" _
   , strWorkGroup

MsgBox (wshShell.RegRead _
   ("HKEY_LOCAL_MACHINE\" _
   & "System\" _
   & "CurrentControlSet\" _
   & "Services\" _
   & "Vxd\" _
   & "VnetSup\" _
   & "WorkGroup"))
End Sub

Thanks
0
Comment
Question by:Juilette
  • 3
4 Comments
 
LVL 18

Accepted Solution

by:
mgfranz earned 69 total points
ID: 2691941
Sure easy.  Try this;

// Form.htm

<form method=get action=getit.asp>
Enter Your select string: <input type="text" name="GetText"><br>
<input type="submit" name="submit" value="Submit">
<input type="Reset">
</form>

On the getit.asp page;

<%
' Make your dB connection and open therecordset here, I am showing a DNS-less conection for simplicity

Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionTimeout = 15
conn.CommandTimeout =  10
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("../data/test1.mdb")
Set rs = Server.CreateObject("ADODB.Recordset")

%>

This is what we found as a match<br>

<%
sFile = Request.Form("GetText")
SQL = "SELECT sFileName, sFileDisplay FROM Table WHERE sFileName ='%"& (sFile) &"%'"
rs.Open SQL, conn, 2, 1
%>
<%
If Not rs.eof Then
%>
<table>
<tr bgcolor="#cbcb96">
<td align="left" align="center">sFileName</td>
<td  align="left" align="center">sFileDisplay</td>
</tr>
<%
On Error Resume Next
rs.MoveFirst
do while Not rs.eof
 %>
<tr valign="top">
<td valign="baseline" width=75>&nbsp;<a href=wine.asp?field=<%=Server.HTMLEncode(rs.Fields("sFileName").Value)%>><%=Server.HTMLEncode(rs.Fields("sFileName").Value)%></a></td>
<td width=65 valign="baseline">
<%= Server.HTMLEncode(rs.Fields("sFileDisplay").Value)%></td>
</tr>
</table>
</html>

You know the drill... clean-up and table layout...

Mark
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 2691947
I forgot to close the loop...

Here is the closing table tag and the loop call;

<%
rs.MoveNext
loop
%>
</table>

Also in the href tag you place whatever .asp file or htm file you need... ;-)
0
 
LVL 4

Author Comment

by:Juilette
ID: 2692793
I'll give you the points now and I'll check it later...plese stay attached for a day or so in case I need a little push.

Thanks
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 2693483
No problem, I'm not going anywhere... ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now