Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

modifying data

Modifying data is a bit more complicated because the script must make certain that the appropriate record is in fact available, in other words that it exists and is not locked by a security setting or other transaction. So this example uses three scripts. The first, amend_select.asp, generates an HTML form listing the available categories from the Categories table. It passes your selection to the second, amend_change.asp, which creates a new form displaying the selected record's current values as editable fields. Those are submitted to the third script, amend.asp, which updates the actual database record accordingly with the new values.

To try these scripts out, install the files and call up the following URL:http://localhost/sample/amend_select.asp

It should display a simple drop-down control, a <select></select> element named ProdCats with an <option></option> for each CategoryName in the categories table. Select a category and click the Submit button.

This will execute amend_change.asp, which uses the submitted ProdCats to build a SQL query and generate a new form with the appropriate record's CategoryID, CategoryName and Description values. Modify the name and description and click Change to send the new values to amend.asp. That script will construct and execute a SQL UPDATE statement from the new values. If successful, it returns the confirmation message: You have successfully amended a record.

Opening the Categories table in access should reveal your changes.

Note that the second template, amend_change.asp, puts the CategoryID in a hidden input named txtID. We need to pass the CategoryID value to amend.asp in order to uniquely identify the record, but because it is an AutoNumber field, we don't want the user to modify it. By using a hidden input, the field is passed along, but the user never sees or changes it. This is the standard way to include a record's unique, automatically generated identifier in an HTML form.

Click Next for Deleting-data

Share:

No comments:

Post a Comment

Translate



PageRank
Your email address:

Delivered by FeedBurner

Search

Infolinks Text Ads

blog.feedspot.com Microsoft Access Blogs

Popular Posts

Search This Blog

Blog Archive

Powered by Blogger.

Labels

Forms Functions How Tos MS-Access Security Reports msaccess forms Animations msaccess animation Utilities msaccess controls Access and Internet MS-Access Scurity MS-Access and Internet Queries External Links msaccess reports msaccess tips Menus and Toolbars Accesstips MsaccessLinks Process Controls Art Work Downloads msaccess How Tos Graph Charts msaccessQuery List Boxes Command Buttons Emails and Alerts Query Combo Boxes Custom Wizards DOS Commands ms-access functions msaccess functions msaccess graphs msaccess reporttricks Array msaccessprocess security advanced Access Security Custom Functions Data Macros Menus Property Report Top Values VBA msaccess email msaccess menus progressmeter Access2007 Auto-Number Calculation Command Button Copy Data Type Field Type Fields Form Join Microsoft Numbering System Records Security Split SubForm Table Utility Variables Workgroup database msaccess wizards Access2003 Accounting Year Action Animation Attachment Binary Numbers Bookmarks Budgeting ChDir Color Palette Conditional Formatting Controls Data Filtering Defining Pages Diagram Disk Dynamic Lookup Error Handler Excel Export Expression External Filter Form Instances Formatting Groups Hexadecimal Numbers Import Labels List Logo Macro Mail Merge Main Form Memo Methods Monitoring Object Reference Objects Octal Numbers Operating System Paste Primary-Key Product Rank Reading Recordset Rich Text Sequence SetFocus Summary Tab-Page Tables Time Difference Union Query User Users Water-Mark Word automatically commands function hyperlinks iSeries Date iif ms-access msaccess msaccess alerts pdf files reference restore switch text toolbar tutorial updating upload vba code

Featured Post

Passing Two Dimensional Array to Function

First of all, I have some good news for you, our website: LEARN MS-ACCESS TIPS AND TRICKS has been selected by https://blog.feedspot.com pa...

Labels

Blog Archive

Recent Posts