Updating database using forms

Results 1 to 2 of 2

Thread: Updating database using forms

  1. #1
    Judy A. Guest

    Default Updating database using forms

    I can take information from one Access database (Let&#039s call it Product_type) and use it to create options in a select box in a form that ultimateley deposits the information in another access database (Let&#039s call it Catalogue). And, I can retrieve a recordset from "Catalogue", and put it into a text box for modification. Unfortunately, I cannot figure out how to take an item from a record set, and have it display the selected value while allowing the individual updating the record to select a different value using a select box, the values of which are once again based on "Product_type".<BR><BR>I have consulted a number of books, and and in the sections that deal with updating records, they only use text boxes, not other types of inputs such as Select boxes, radio buttons, and check boxes. <BR><BR>Is there an ASP solution?

  2. #2
    Join Date
    Dec 1969

    Default Probably really shoud be in FAQ

    Actually, this question appears here perhaps 2 to 4 times a week. I&#039m suprised it hasn&#039t made it into the FAQ.<BR><BR>First, I *hope* you mean Access TABLES and not separate databases. Separate databases is a *bad* idea and should definitely be avoided unless you can come up with a REAL good reason!<BR><BR>I presume you mean that you want to display the original list of choices (the selections from the Product_type table) and pre-select the one that matches the entry in the Catalogue table, right? So that the user can leave the SELECT as-is and thus leave the pre-selection alone *or* choose another option from the original list? Yes? If so, then this is indeed the most common usage.<BR><BR>You *will* have to do two queries in the "edit" page. First you get the Catalogue record to be edited. Then, in order to display the SELECT with the appropriate option pre-chosen, you do the same query you did in the first place to get the list of selections. But now you add a twist. Something like this:<BR><BR>&#060;%<BR>Set RSedit = myConnection.Execute("SELECT * FROM Catalogue WHERE productID=" & request(prodID)<BR>Set RSprods = myConnection.Execute("SELECT subID, prodSize FROM Product_type ORDER BY prodName")<BR>%&#062;<BR><BR>&#060;FORM ...&#062;<BR>&#060;INPUT Name="prodName" Value="&#060;% = RSedit("productName") %&#062;" &#062;<BR>...<BR>&#060;SELECT&#062;<BR>&#060;%<BR> editSubId = RSedit("subID") &#039 copy to local for efficiency<BR>Do Until RSprods.EOF<BR> &nbsp; Response.Write "&#060;OPTION Value=&#039" & RSprods("subID") & "&#039 "<BR> &nbsp; If RSprods("subID") = editSubId Then Response.Write "SELECTED"<BR> &nbsp; Response.Write "&#062;" & RSprods("prodSize") & "&#060;/OPTION&#062;" & vbNewLIne<BR> &nbsp; RSprods.Next<BR>Loop<BR>...<BR>%&#062;<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts