Question

How to prefill Frontpage2003 text boxes based on MS Access query for USER modification.

Asked by: MrGD

I am really new to Web design so please be specific on steps.  I have a web page linked to an MS Access database.  From the web page, I have a drop down box which is used to pass a parameter to a query that displays a single row of Database Results.  What I would like to do is populate (pre fill) text boxes from the query results listed above.  The reason I want to populate the text boxes is to give the USER the opportunity to modify the data within the text box, then update the database with the changes, or if no previous data, add a new record to the database.  I should probably mention that the dropdown box used to pass the query parameter and the Database Results are within a Web page Form with a Submit button.  Is it possible to pass the results of the query populating the Database Results area to the text boxes or is it possible to link or pull the data from the Database Results area to populate the text box value?  I normally develop in VBA and SQL, am I attempting to do something that is not possible in Web pages?  Can I keep everything on one page?  There is plenty of physical space available.  

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-11-20 at 14:36:45ID21637525
Tags

down

,

form

,

from

,

frontpage2003

,

prefill

Topic

FrontPage-Expressions

Participating Experts
1
Points
500
Comments
4

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Populating DropDowns from A Database
    Okay here is my question... I have four drop down boxes that will be populated from a database. But I want them to change based on what one dropdown is showing... ex Drop down 1 - Region (north america, south america) Drop down 2 - Country (US, CAN) Drop Down 3 - SubR...
  2. populate Excel dropdown with Access data
    How would I go about populating a dropdown list for a column of cells so it populates the list from a query returned from an Access table? Then based on what the user choooses, I want the index field to be stored in the cell rather than the description. Thanks.
  3. Dynamic ranges to populate dropdowns - VBA and .NET
    I have and Excel workbook that I populate from an ASP.NET page. Let's say this query returns 3 fields - Name and OccupationID (as an Integer) and NationalityID (as an integer) The workbook contains 2 worksheets: One sheet - "MyData" contains rows of data from a SQL...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: wcameronPosted on 2005-11-21 at 10:44:08ID: 15335999

The process takes three steps. The first is to create a pick list to list multiple records so that you can select one to be edited. We'll show you how to create this pick list and then link to a second page called ProductEdit.asp. This page will contain a form that will allow you to make changes to your record. This page does not actually make the changes though. It sends your changes to a third page called ProductUpdate.asp. This page contains the code that will update the appropriate record in the database.

So let's get started
Step 1 - Select the Record
If you want to edit a record, you need to have a way to select a single record.

Insert a Database Results Wizard that will list all of the products in your catalog. Then add an additional column with Edit Record as the heading.

Now in the column, beside the product name field, enter the word Edit. Highlight it and select Insert Hyperlink. Point the link to ProductEdit.asp and select Parameter. Insert the parameter ProductID = ProductID. Now clicking on this link will take you to the ProductEdit form with the data for this value already loaded.

Step 2 - Create the Database Change Form
On a blank page, insert a form. Now, select Insert-Database-Results:



Select the Northwind connection and click next.
Select Products as the Record Source and click next:
On this screen, you can edit the list of fields if you wish. In this case, we'll use all the fields. Click the More Options button:
Now click on the Criteria button:
When the criteria screen opens, click add:
Since ProductID is our key, select ProductID as the field name. The screen should look like the above graphic. Click OK:

The criteria screen now reflects the fact that the form will need to be passed the ProductID parameter before loading. This will tell it which records data to populate the field with. Click OK and then Ordering in the More Options screen. Click OK in the More Options screen and Next to take you to Step 4 of the DRW.

Be sure to select List - one field per item from the formatting options and Text fields from the List options. Deselect the horizontal separator option.

Click Next.
Select Display all records together and then finish.
The form now has text fields that when passed the correct parameter will be populated with the data currently stored in the database record.

Dealing with the ProductID Field
There are two possible ways to deal with the ProductID Field

Leave the ProductID field as it is. I usually avoid this option because the ProductID field is usually just an autonumber field and as such is not an editable field anyway. If isn't editable, than your users really don't need to see it.
The preferred option. Delete the row that includes the ProductID field.  If you DO delete it, you will need to send the value to the ProductUpdate.asp page as a hidden value.

Once you've created the form, you need to send it to the page ProductUpdate.asp. Open the form properties and Select Send to other.

Click the options button and under Action type ProductUpdate.asp. This tells the form to send the changes to the ProductUpdate.asp which we'll create in the next section.

One more thing though. If, as I advised above, you deleted the ProductID row from the Product Edit form, than you will need to passed the ProductID field as a hidden value to the ProductUpdate.asp page.

Remember, this next step is ONLY necessary if you deleted the ProductID row from the Product Edit form as was suggested above.

In the Form Properties Screen click Advanced to open the Advanced Form Properties. Now Click the Add Button so that we can add the ProductID field as a hidden variable. Type ProductID into the Name box and into the Value box type:

<%=Request("ProductID")%>

It should look like the following image.

Click OK and the advanced properties window will now show the hidden field. Click OK twice to close out of the Form Properties windows.

Save your file. You're now ready for the final step.

Step 3 - Create ProductUpdate.asp
The final step will take the form changes and update the actual database record.

Open a blank page. Now we'll create a Database Results Wizard (DRW) that will update a record in the current database.

Select the Northwind connection from the list of database connections and click "Next".
Select Custom Query and then Edit. Type the following into the Edit window. You must type it exactly as it appears below:

UPDATE Products
SET
ProductName='::ProductName::',
SupplierID='::SupplierID::',
CategoryID='::CategoryID::',
QuantityPerUnit='::QuantityPerUnit::',
UnitPrice='::UnitPrice::',
UnitsInStock='::UnitsInStock::',
UnitsOnOrder='::UnitsOnOrder::',
ReorderLevel='::ReorderLevel::'
WHERE ProductID=::ProductID::

Don't forget that the end of the last field name (in this case ReorderLevel) you DO NOT put a comma at the end of the line. Also, be sure there is no comma on the final line with the WHERE statement.

Here are a few rules about formatting the various types of fields so that they update correctly.

Field Type Formatting
Text   '::TextFieldName::'
Number  ::NumberFieldName::
Dates '::DateFieldName::'
Boolean* ::BooleanFieldName::

*Boolean fields are those fields that use a yes/no true/false or on/off value. They include most radio and check boxes.

For more information on the correct SQL for various field types and situations, check out this Microsoft Support Document:

http://support.microsoft.com/default.aspx?scid=kb;[LN];306430

As you can see, different types of field need different formatting. Be sure to match your format with the correct data type.

Once you have typed in the custom SQL code, click the "Verify Query" button to make sure the code can be verified. This will help ensure that you have typed the code correctly and that you have not misspelled your field names.

If you get a message indicating that it cannot verify the query, delete all the field values except for the first one. See if it can be verified. Then add the second field. Add each field one by one until you get the error message, this will tell you where the problem lies. Once all of your SQL has been correctly entered, you should be able to verify the query.

Click OK, and then More Options
Whenever using an edit script, it's critical to have default values entered into every field. They don't need to be relevant, but your form needs data to input if you leave a field blank. The update script cannot deal with blank data.

Always enter a default value to prevent getting error messages in your browser. If You DO get an error, the message may resemble the following.

One or more form fields were empty. You should provide default values for all form fields that are used in the query.

or even more frightening:

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Number: -2147217904 (0x80040E10)
Source: Microsoft OLE DB Provider for ODBC Drivers

The above message simply means that the DRW expected to receive a parameter, but did not get one. By entering a default, you will always make sure it gets a parameter, even if it does not correspond to a record in the database.

In the Defaults screen, double-click on Product Name to open the Default Value screen.
For each field, type a default value. For the Product Name Field, input None. Now enter a value for each field in the form.

If you have a date field, you need to use some FrontPage Magic. For the default date I use an irrelevant date like 01-01-1950. This must be a date that will not be used in any of your records. This means that in records for which no date is entered, the date 01-01-1950 will be stored in your database.

How do you keep that date from showing up in your FrontPage. You do that using the iif statement as described in this tutorial.

In this case, in a blank column in your query use the following syntax:

Date: IIf(IsNull([DateField]) Or [DateField]=#1/1/1950#,””,[DateField])

Assuming the date field in your form is called DateField, then this will take that data and create a new field called Date. If the date field is null OR if the date is equal to 1/1/1950 then it will simply display nothing (signified by two double brackets side by side).

This should solve your problem. Don’t forget to include the date value in # rather then “.

Click OK to return to the More Options screen and OK again to return to Step 3 of the DRW. Click Next to move to Step 4. Select List - one field per item and paragraphs as the list option.

Click next. In Step 5 select Display all records together and deselect Add Search Form. Finally click Finish.

Finally, click finish and you'll see a DRW that seems to contain nothing. Do not delete it. It is ready to go. Save this page as ProductUpdate.asp.

You should now be ready to go - give it a try.

 

by: MrGDPosted on 2005-12-08 at 01:07:10ID: 15443022

Great got things working except that Step 1's listing is too large to be pratical.  I created 4 drop down boxes which help drill down to the specific listing needed.  I have all of that working, but I get the error "Database Results Wizard Error  The operation failed.  If this continues, please contact your server administrator."  until all of the drop down boxes have been selected.    I am assuming that the Database Results area is attempting to update each time one of the drop down boxes are selected and all of the Parameters are not exstablished yet.  Is there a way to force the Database Results area to wait until all of the boxes have a value in it then automatically update?  I suppose that I could put in on another page, but I wanted to give the user the ability to quickly change one of the drop down boxes if they did not see the results they needed to edit.

 

by: MrGDPosted on 2005-12-08 at 03:15:44ID: 15443458

Thought I better add that the drop down boxes are populated based on the selection of the previous box.  For example, the first drop down is populated with all of the countries listed in the database table, after the user selects one of the countries, then the form queries the database again to passing the Parameter of the Country drop down box to a query that populates the second drop down box.  Appreciate the help and patience.    

 

by: wcameronPosted on 2005-12-08 at 10:00:21ID: 15446559

It's sometimes difficult to describe in a short message. To use progressive drop-downs you need to create a progressive search page. I've described it in detail here:

http://www.frontpagemagic.com/CreatingSearchPages/index.htm

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...