Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Populate web form field based on another fields entry requires table lookup

Posted on 2008-10-24
4
902 Views
Last Modified: 2012-05-05
I have a working database where I am using a web form to collect input from users.
On one particular field that the users need to populate called ACNA, I want to look up the value they have entered in a database table named tblMasterACNA. The tblMasterACNA has 3 fields ID, ACNA and Customer.
I need to auto populate the text box "Customer" on my form based on looking in the tblMasterACNA and matching the entry to what is in the field ACNA and then of course displaying the corresponding "Customer" contained in field "Customer"

It is important for the Customer name to appear in the text box labled Customer after the lookup.
I tried this with no success:

=DLookup("[fieldACNA]","[tblMasterACNA]","[fieldACNA] = " & CInt([Customer].Caption) )

Below is the code I am using: (Note where  have the above snipet inserted, is this wrong?)
<!-- Begin form code --> 
 
<FIELDSET>
<LEGEND><b><h1>Proactive Maintenance Issue Referral Form<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Potomac Region</h1></b></LEGEND>
 
<H3>* All fields are required*</H3>
 
 
 
<form name="Input" method="Post" action="confirm.asp">
 
<table>
<input type="hidden" name="Region" value="Potomac">
<tr><td>Date Added: </td>
<tr><td><input type="text" name="Date Added" size="25" onkeypress="return handleEnter(this, event)"></td></tr>
<tr><td>CAC: </td>
<tr><td><input type="text" name="CAC" onkeypress="return handleEnter(this, event)"></td></tr>
<tr><td>CKTID: </td></tr>
<tr><td><input type="text" name="CKTID"  onkeypress="return handleEnter(this, event)"></td></tr>
<tr><td>ACNA: </td></tr>
<tr><td><input type="text" name="ACNA" onkeypress="return handleEnter(this, event)"></td></tr>
<tr><td>Customer: </td></tr>
<tr><td><input type="text" name="Customer" onkeypress="return handleEnter(this, event)"></td></tr>
 
=DLookup("[fieldACNA]","[tblMasterACNA]","[fieldACNA] = " & CInt([Customer].Caption) )
 
<tr><td>Ticket Number: </td></tr>
<tr><td><input type="text" name="Ticket Number" onkeypress="return handleEnter(this, event)"></td></tr>
<tr><td>Ticket Source: </td></tr>
<tr><td><input type="text" name="Ticket Source" onkeypress="return handleEnter(this, event)"></td></tr>
<tr><td>Monitoring Source: </td></tr>
<tr><td><input type="text" name="Monitoring Source" onkeypress="return handleEnter(this, event)"></td></tr>
<tr><td>Dispostion Code: </td></tr>
<tr><td><input type="text" name="Dispostion Code" onkeypress="return handleEnter(this, event)"></td></tr>
<tr><td>Summary: (limited to 50 Characters)</td></tr>
<tr><td><textarea cols="50" name="Summary" 
onKeyDown="textCounter(this,'progressbar1',56)" 
onKeyUp="textCounter(this,'progressbar1',56)" 
onFocus="textCounter(this,'progressbar1',56)"
></textarea></td></tr> 
</table>
 
<input type="submit" name="Submit" value="Submit Form" class="flashit" onClick='form_name.button_name.value="Please Wait...";return true'>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" value="Clear Form">
 
<div id="progressbar1" class="progress"></div>
<script>textCounter(document.getElementById("maxcharfield"),"progressbar1",20)</script>
 
 
 
</form> 
</FIELDSET>

Open in new window

0
Comment
Question by:vzdog
  • 2
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
Badotz earned 500 total points
ID: 22807239
If this is a web form - running in a web browser - then you cannot use DLOOKUP - the browser has no idea what you mean.

If you are generating this HTML, then you can include the results of DLOOKUP in the generated HTML.

If you want the web page to perform the lookup on some user action, then you will need javascript on the client, and some kind of server language (.NET, php, etc.) to do your "dirty work" for you.
0
 

Author Comment

by:vzdog
ID: 22808851
How?
0
 
LVL 29

Expert Comment

by:Badotz
ID: 22808933
How what?
0
 

Author Comment

by:vzdog
ID: 22995275
No real solution ever provided...
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Random times with 12/24 hour switching 9 28
SetProperty Foreground Colour 5 15
error in For & Next statements 4 24
too few parameters , expected 3 14 14
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 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