If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Updating an access database with linked tables (in Fronpage)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-27-03, 06:59
mannix mannix is offline
Registered User
 
Join Date: Oct 2003
Posts: 2
Red face Updating an access database with linked tables (in Fronpage)

Hi there,

I have two tables in an 'library'access db - one is a books table and the other is a categories table. I have managed to create an input form in Frontpage allowing the user to add a new book and select the category that it belongs in from a dropdown (join to the categories table). The problem is when I try to update a record - I cannot get the dropdown categories list to keep the record value, it just defaults to the top of the list. Does anyone have any idea how to do this - its driving me crazy.

Thanx in advance

Mannix
Reply With Quote
  #2 (permalink)  
Old 10-30-03, 10:42
Melvin Melvin is offline
Registered User
 
Join Date: Oct 2003
Posts: 2
Cool Re: Updating an access database with linked tables (in Fronpage)

Quote:
Originally posted by mannix
Hi there,

I have two tables in an 'library'access db - one is a books table and the other is a categories table. I have managed to create an input form in Frontpage allowing the user to add a new book and select the category that it belongs in from a dropdown (join to the categories table). The problem is when I try to update a record - I cannot get the dropdown categories list to keep the record value, it just defaults to the top of the list. Does anyone have any idea how to do this - its driving me crazy.

Thanx in advance

Mannix
Okay. You need to follow this process (assuming asp page).

1. On page load, determine if this is for a new record or existing

2. If its an existing book then read the data into an array where you know which element contains the category id. This happens before the form is created (remember that asp is processed as the page loads).

3. For a new book set the options with " selected = true " for the first option. For an existing book then look up the category (look in the array in step 2) and when this is the same category then place "selected = true " on the option.

Code


Assumes you have loaded the CategoryID in the BookArray(2) element.

Recordset.MoveFirst
Response.Write("<select name = 'CategoryPicker'>")

While not Recordset.EOF

if BookArray(2) = CategoryRecordset("CategoryID") then
Repsonse.Write("<option selected = true> " & CategoryRecordset("CategoryID") & "</option>"
else
Repsonse.Write("<option> " + CategoryRecordset("CategoryID") + "</option>"
end if

CategoryRecordset.MoveNext

end while
Repsponse.Write("</select>")


Hope this helps a bit and do mind the dodgy VB (Javascript geek is me).
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On