Click to See Complete Forum and Search --> : Can I autocomplete part of a database form?
Levitrious
11-18-2003, 07:14 AM
Couldn't think of a better way to write that subject...
A little background first:
My company manages one of the worlds largest wireless networks. We have a team of roughly 15 technicians operating out of offices in 6 different states monitoring this project. To make life easier, I've built a fairly simple database to manage incidents and equipment failure so that everybody has the most current information about the status of the network.
New problems encountered on the network are entered as incidents. What I want to be able to do is create a method for the techs to add "followup items" to an incident via a Database Access Form. For this to work, I need to find some way to link to a blank form but have it automatically fill in the "incident number" of the incident they were just viewing via a html Database Access Page.
Is there anyway to write into a hyperlink a statement to automatically complete a form field? Or is there another way to accomplish this? Please email me if you need more information "Levitrious@yahoo.com"
Thanks!
slyfox
11-18-2003, 07:36 AM
EASY!
when the form that displays the incident loads, read the "id" of the incident from the database and put it thru as a querystring in the hyperlink...
eg.:
ASP - JScript
<a href="update.asp<%=('?id=' + id)%>">incident</a>
ASP - VBScript
<a href="update.asp<%=('?id=' &id)%>">incident</a>
then..
in you "update.asp" page you read the value sent thru the querystring and display/autofill whatever you want on that page...
but obviously you need extra fields in your table to update the "incidents" by the applicable id..
hope this helps you
Levitrious
11-18-2003, 10:31 AM
Wow .. learning how little I know about all of this.
Okay.. I've tried to make this work but without success. It's probably just a problem with formatting on my part. If you could, what would the specific code be for the link? It's an Access Database running on a Windows2000 Server.
Path to form: usvidb_connect_interface/Actions/submission_form.asp
Form Field Name: Form_IncidentNumber
Database Table Field Name: IncidentNumber
I tried about 30 different variations on the original suggestion with no luck (again.. probably due to my own inexperience with this).
slyfox
11-18-2003, 11:34 AM
which are you not comming right with.. getting the value from the database or sending it thru the hyperlink or receiving it on the other side... or all of it?
and which language is asp are you using?
Levitrious
11-18-2003, 11:57 AM
Either and or both.
In some variations of the link I received a "Page Cannot be Displayed" splash page, in others the form would come up but without the field filled in.
I'm not sure what version of ASP I am using.. the form page was automatically generated by Frontpage 2002 (a sin, I know). The other problem that I am encountering is that the DAP (Database Access Page) that I am using to connect over is created from within Access. There's a way to embed hyperlinks into the page.. it gives you a field to enter the href and another for the "Server Filter". From those two it creates the hyperlink (typically). I can override it and put in a custom link but it's a pain due to the way Access builds the Database Access Page.
Make sense?
slyfox
11-18-2003, 12:24 PM
kinda.. send me the source code
Levitrious
11-18-2003, 01:02 PM
Do you want the source code for the DAP or for the Form?
slyfox
11-18-2003, 01:15 PM
all of what you are busy with that has problems...
Levitrious
11-18-2003, 01:28 PM
To make heads or tales of it you'll need access to the database.. I'll set up a temporary portal to a portion of it with the related links to the form in question. I'll PM you with the IP address of the portal when I get it setup.
slyfox
11-18-2003, 01:35 PM
no problem... but i'll be out for about 2 hours... will get and answer you within 2 hours... alternatively don't worry about heads or tales... i will manage with whatever you send me;)
slyfox
11-18-2003, 03:25 PM
ok... i see why you got stuck! (the page you're trying to send the query with a hyperlink has a .html extension... sorry, won't work!!)
the only way you are going to get the "incident id" to your form(submission_form.asp) is by requesting the value with submission_form.asp itself from the page posting the request..
Let me explain how:
open/edit submission_form.asp in code view and paste the following code at the top of the page:
<%@LANGUAGE="JAVASCRIPT"%>
<%
/*get the value from the applicable textbox from the previous page*/
var iString = Request.Form("textboxname");
%>
then paste the following in the "value" of the "incident" textbox where you want it to display:
<%=(iString)%>
eg:
<input type="text" name="incident" value="<%=(iString)%>">
test and voila... value is sent thru... easy as pie!:cool:
Levitrious
11-18-2003, 10:39 PM
Thanks!
I'll give that a shot first thing tomorrow morning and let you know how it turns out!
Thanks again!
slyfox
11-19-2003, 06:25 AM
no problem..
Levitrious
11-19-2003, 06:33 AM
Hmm.. not working so far here. Here's what I tried:
1. Copied and pasted above code exactly as entered at the very top of the ASP form's code.
2. Pasted exactly as entered between ASP form code and HTML form page code
3. Modified the above code to reflect the textbox name on the form
4. Modified the above code to reflect the form name on the form
In all cases I received this error:
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
--------------------------------------------------------------------------------
Technical Information (for support personnel)
Error Type:
Active Server Pages, ASP 0140 (0x80004005)
The @ command must be the first command within the Active Server Page.
/usvidb_connect_interface/Actions/submission_form.asp, line 74
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Page:
GET /usvidb_connect_interface/Actions/submission_form.asp
Levitrious
11-19-2003, 10:35 AM
I found a way around this problem. I've created a field that automatically populates a URL onto my Incident Page. Within the database the field looks something like:
/database_interface/actions/submission_form.asp?IN=[IncidentNumber]
I then modified the form so that the default value of the Incident Number field looks for the "IN=" in the URL with the following code:
<%=Request.Querystring("IN")$>
It's not the cleanest way to do it, but it certainly solves the problem.
Slyfox.. thanks again for all your help in getting to this point!!
slyfox
11-19-2003, 01:01 PM
Glad you got the problem solved... and from my side it's a pleasure!;)