473,659 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with query for my code...

2 New Member
The following form code is used to enter data into MSAccess database.

Expand|Select|Wrap|Line Numbers
  1. <div id="container" align="center">
  2.   <form action="First_Entry.asp" method="POST" name="form1">
  3.    <table border="0" width="100%" cellspacing="0" cellpadding="0">
  4.     <tr>
  5.      <td colspan="2" align="center"><img src="images/Abstract_Header5.gif" alt="Abstract Logo" border="0"></td>
  6.     </tr>
  7.     <tr>
  8.      <td colspan="2" align="center" class="text14BLB">New Subdivision Entry Form</td>
  9.     </tr>
  10.     <tr>
  11.      <td colspan="2" align="center" class="text12RS">* mark fields that are mandatory</td>
  12.     </tr>
  13.     <tr>
  14.      <td colspan="2">&nbsp;</td>
  15.     </tr>
  16.     <tr>
  17.      <td width="50%" align="right" class="text12BLB" style="padding-right: 10px"><span class="text12RB">*</span>Enter Subdivision Name:</td>
  18.      <td width="50%" align="left"><input type="text" name="SubName" onBlur="this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1);"></td>
  19.     </tr>
  20.     <tr>
  21.      <td style="border-top:dashed 1px #ccc" colspan="2">&nbsp;</td>
  22.     </tr>
  23.     <tr>
  24.      <td width="50%" align="right" class="text12BLB" style="padding-right: 10px"><span class="text12RB">*</span>Document Type:</td>
  25.      <td width="50%" align="left"><input type="text" name="DocType" onBlur="this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1);"></td>
  26.     </tr>
  27.     <tr>
  28.      <td style="border-top:dashed 1px #ccc" colspan="2">&nbsp;</td>
  29.     </tr>
  30.     <tr>
  31.      <td width="50%" align="right" class="text12BLB" style="padding-right: 10px"><span class="text12RB">*</span>Reception Number:</td>
  32.      <td width="50%" align="left"><input type="text" name="Reception" size="8" maxlength="8"></td>
  33.     </tr>
  34.     <tr>
  35.      <td style="border-top:dashed 1px #ccc" colspan="2">&nbsp;</td>
  36.     </tr>
  37.     <tr>
  38.      <td width="50%" align="right" class="text12BLB" style="padding-right: 10px"><span class="text12RB">*</span>Link to Document:</td>
  39.      <td width="50%" align="left"><input type="text" name="LinkTo" value=""></td>
  40.     </tr>
  41.  
  42.     <tr>
  43.      <td style="border-top:dashed 1px #ccc" colspan="2">&nbsp;</td>
  44.     </tr>
  45.  
  46.     <tr>
  47.      <td colspan="2">&nbsp;</td>
  48.     </tr>
  49.     <tr>
  50.      <td align="center" colspan="2"><input type="submit" value="Submit">&nbsp;&nbsp;<input type="reset" value="Reset"></td>
  51.     </tr>
  52.     <tr>
  53.      <td colspan="2">&nbsp;</td>
  54.     </tr>
  55.     <tr>
  56.      <td colspan="2">&nbsp;</td>
  57.     </tr>
  58.     <tr>
  59.      <td colspan="2" align="center"><span class="text12BLN">Having problems?&nbsp;</span><a href="ContactForm/contactus.html" title="Contact Form"><span class="text12BLB">Contact Us</span></a></td>
  60.     </tr>
  61.     <tr>
  62.      <td colspan="2">&nbsp;</td>
  63.     </tr>
  64.     <tr>
  65.      <td colspan="2" align="center"><a href="http://www.abstracttitle.biz" title="Return to Home Page"><span class="text12RS">Return to Home</span></a></td>
  66.     </tr>
  67.    </table>
  68.   </form>
  69. </div>
=============== =============
The form action file 'First_Entry.as p' below is the code I am using to connect to db1.mdb and it works, however, I would like to know how to modify to do a Query search for 'SubName', which is the Subdivision name. Each subdivision has multiple 'DocType' associated with it. I would like to be able to view ALL of the 'DocType' associated with each 'SubName'. Is this possible? Thanks in advance!

Expand|Select|Wrap|Line Numbers
  1. <%
  2. if Request.ServerVariables("REQUEST_METHOD") = "POST" then
  3.  
  4.         strSubName = Request.Form("SubName")
  5.         strDocType = Request.Form("DocType")
  6.         strReception = Request.Form("Reception")
  7.         strLinkTo = Request.Form("LinkTo")
  8.  
  9.     strDate = Now()
  10.     blnValid = True
  11.     strValid = "<p align=""left""><font face=""Verdana"" size=""4"" color=""#FF00000""><b>" & _
  12.                "Entry Failed..!!</b></font></p>" & vbCrLf & _
  13.                "<ul><font face=""Verdana"" size=""2"" color=""#000080"">" & vbCrLf
  14.  
  15.     if strSubName = "" then
  16.         blnValid = False
  17.         strValid = strValid & "<table border=""0"" width=""302"" cellspacing=""0"" cellpadding=""0"" height=""22"">"  & vbCrLf &_
  18.              "<tr>"  & vbCrLf &_
  19.              "<td width=""300"" height=""22""><p align=""left""><font face=""Verdana"" size=""2"" color=""#000080""># Please Enter Subdivision Name.</p></td>"  & vbCrLf &_
  20.              "</tr>" & vbCrLf &_
  21.              "</table>" 
  22.    end if 
  23.  
  24.     if strDocType = "" then
  25.         blnValid = False
  26.         strValid = strValid & "<table border=""0"" width=""302"" cellspacing=""0"" cellpadding=""0"" height=""22"">"  & vbCrLf &_
  27.              "<tr>"  & vbCrLf &_
  28.              "<td width=""300"" height=""22""><p align=""left""><font face=""Verdana"" size=""2"" color=""#000080""># Please Enter Document Type.</p></td>"  & vbCrLf &_
  29.              "</tr>" & vbCrLf &_
  30.              "</table>" 
  31.    end if 
  32.  
  33.     if strReception = "" then
  34.         blnValid = False
  35.         strValid = strValid & "<table border=""0"" width=""302"" cellspacing=""0"" cellpadding=""0"" height=""22"">"  & vbCrLf &_
  36.              "<tr>"  & vbCrLf &_
  37.              "<td width=""300"" height=""22""><p align=""left""><font face=""Verdana"" size=""2"" color=""#000080""># Please Enter Reception Number.</p></td>"  & vbCrLf &_
  38.              "</tr>" & vbCrLf &_
  39.              "</table>"
  40.    end if 
  41.  
  42.     if strLinkTo = "" then
  43.         blnValid = False
  44.         strValid = strValid & "<table border=""0"" width=""302"" cellspacing=""0"" cellpadding=""0"" height=""22"">"  & vbCrLf &_
  45.              "<tr>"  & vbCrLf &_
  46.              "<td width=""300"" height=""22""><p align=""left""><font face=""Verdana"" size=""2"" color=""#000080""># Please Enter Link to Document.</p></td>"  & vbCrLf &_
  47.              "</tr>" & vbCrLf &_
  48.              "</table>"
  49.    end if 
  50.             strValid =  strValid & "<p align=""center""><a href=""CovData.asp"" target=""_top"" title=""Click Here""><font face=""Verdana"" size=""2"" color=""#0000FF"">Click Here To Continue</font></a></p>"
  51. else
  52.     strValid =  strValid & Response.Redirect ("CovData.asp")
  53.    end if  
  54.  
  55.     if blnValid = True then
  56.  
  57.         strDSNPath = "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db\db1.mdb")
  58.         strSQL_Insert = "INSERT INTO SubTbl (SubName, DocType, Reception, LinkTo)" & _
  59.                         " VALUES ('" & strSubName & "','" & strDocType & "','" & strReception & "','" & strLinkTo & "');"
  60.  
  61.        Set Conn=Server.CreateObject("ADODB.Connection")
  62.             Conn.Open strDSNPath
  63.                 On error resume next
  64.                 Conn.Execute strSQL_Insert
  65.             Conn.Close
  66.         Set Conn = Nothing   
  67.  
  68.     if err.number <> 0 then
  69.  
  70.             strValid = "<p align=center><font face=""Verdana"" size=""2"" color=""#F0000""><b>" & _
  71.                        "Sorry!</font></b><font face=""Verdana"" size=""2"" color=""#000080""> This Subdivision has been filled by someone else.</font><br>" & _
  72.                        "<br><font face=""Verdana"" size=""2"" color=""#000080"">Please choose a different <b>E-Mail Address</b> and <b>Username.</b></br>" & _
  73.                        "</font></p>" & _
  74.                        "<br><p align=""center""><a href=""CovData.asp"" target=""_self"" title=""Click Here""><font face=""Verdana"" size=""2"" color=""#0000FF"">Click Here To Continue</font></a></p>"
  75.         else
  76.  
  77.         strValid = "<p align=""left""><b><font face=""Verdana"" size=""2"" color=""#008080"">Dear " & strSubName & " " & strDocType & ".</b></font>" & _
  78.     "<p align=""center""><font face=""Verdana"" size=""2"" color=""#000080"">Your Name Has Been Registerd Successfully.</font></p><br>" & _
  79.                   "<center><table border=""0"" width=""327"" height=""39"" cellspacing=""0"" cellpadding=""0"">" &_
  80.     "<tr>" &_
  81.     "<td width=""98"" valign=""middle"" align=""center"" height=""21""><font size=""2"" face=""Verdana"" color=""#000080""><b>Username</b></font></td>" &_
  82.     "<td width=""20"" align=""left"" valign=""middle"" height=""21""><font size=""2"" face=""Verdana""><b>-</b></font></td>" &_
  83.     "<td width=""187"" valign=""middle"" align=""left"" height=""21""><font size=""2"" face=""Verdana"" color=""#FF0000"">" & strLinkTo & "</font></td>" &_
  84.     "</tr>" &_
  85.     "<tr>" &_
  86.     "<td width=""98"" valign=""middle"" align=""center"" height=""18""><font size=""2"" face=""Verdana"" color=""#000080""><b>Password</b></font></td>" &_
  87.     "<td width=""20"" align=""left"" valign=""middle"" height=""18""><font size=""2"" face=""Verdana""><b>-</b></font></td>" &_
  88.     "<td width=""187"" valign=""middle"" align=""left"" height=""18""><font size=""2"" face=""Verdana"" color=""#FF0000"">" & strPassword & "</font></td>" &_
  89.     "</tr></table></center>" &_
  90.     "<p align=""center""><a href=""site-admin/editSub.asp"" target=""_top"" title=""Click Here""><font face=""Verdana"" size=""2"" color=""#0000FF"">Click Here To Login</font></a></p>"
  91.  
  92. end if
  93. %>
Apr 20 '11 #1
0 1280

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1847
by: Colm O'Brien | last post by:
I have a field called year end month where records hold the month financial year end for accounts is stored. i need to query the data base and return all records where year end month is less than or equal to user input (eg april) any ideas
10
2578
by: L. R. Du Broff | last post by:
I own a small business. Need to track a few hundred pieces of rental equipment that can be in any of a few dozen locations. I'm an old-time C language programmer (UNIX environment). If the only tool you know how to use is a hammer, every problem tends to look like a nail. That said, I could solve my problem in C, but it's not the right tool. I need to come into the Windows world, and I need to get this done in Access or something...
1
3472
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select count_big(*) from sys.objects s1, sys.objects s2, sys.objects s3, sys.objects s4, sys.objects s5 PRINT GETDATE()
0
1004
by: Rational Repairs | last post by:
I have a query situation I can't, for the life of me, figure out. Any help would be greatly appretiated. I have a table of customers, and a seperate table of orders. An order consists of (among other things) a Buyer and an End User. A single customer can be a buyer, end user, both, or neither. Also a single customer can have many orders with the aforementioned criteria. I simply want a query that will show all customers who are either...
2
2166
by: RoomfulExpress | last post by:
The only problem I'm having with this code is when there are no values returned for the query, it is still allowing you to see and click the 'Next>>'. It disappears when there is at least one return on the search, but when there is none, it shows up. Here is where I got the source code from and of course the forum is 404'd. They're code has the exact same problem as my modified code. http://www.designplace.org/scripts.php?page=1&c_id=25 my...
2
1175
by: Gilberto | last post by:
Hello, I have a table ENGINEERING with product informationm. The field COMMODITY represent different categories which are in french. In order to be able to create reports with the COMMODITY information in ENGLISH i created another table COMMODITY NAME with the following fields: commodity (the french one) commodityenglish Both tables have a one-to-one relationship through the field "COMMODITY" Im trying to modify the query code so that...
10
1675
by: paul814 | last post by:
I am having a bit of a problem with some code....can someone give me some suggestions? Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\production \date2.php on line 28 line 28 is this line: while($row = mysql_fetch_array(mysql_query($sql)) { It is the first while..
3
1481
by: thalamus | last post by:
Hello: I'm working with an URL with this query string at the end: /page/?item=01x-001/ I want to check to make sure the parameter "item" exists in the address, and that it is displayed (entered) correctly in the address bar ("item" and not, e.g. "itwm"); Right now my validation code has this structure (quasi-code):
6
2601
Lensmeister
by: Lensmeister | last post by:
Hi, As a newbie here I hope someone cane help me. I have Acess 2003 and am making a database that holds records or football matches. I haven't created any relationships as yet. The main table is called tbl_Matches and the Primary key is an auto number. In this table I have the following fields I am using in a query (there are other fields in the table but not used in the query).
4
1760
by: asivakrupa | last post by:
Hi, I need a query in SQL Sever which will select the records based on the date of creation.The query is, List the opportunity name where the date of creation is before 3 weeks. I do not know to create a SQL query for this. Pls do help me out with this. Thanks in advance. Sivakrupa Arulmani.
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8539
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2759
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.