Use a radio button to select record to edit

Posted on 2007-11-27
Medium Priority
Last Modified: 2010-04-25
Hi all

Scenario, 2 people dealing with records, person1 enters record with add screen which updates tab1
person2, deals with the record in table1, when they have done there job, the record is moved into table 2 and archived with a complete flag.

I am sure I could do this with 1 table but I need to do it this way to suit a business need.

so lets say I have 2 tables,

tab1 has fields
init, surname, date(ymmdd)
tab2 has fields
init, surname, date(ymmdd), complete

I already have the page for person1 setup and writing to a sql db.
For person 2, I need 2 screens, 1st one that scans table1 for records, a sort would be nice perhaps by date
Records should be presented as a 1 liner so lets say name only  (Brief) with a radio button next to them so person2 can select with the radio button the record to retrieve, pass the record to a 2nd screen where the whole detail is shown. Whn person2 is happy, they push a button on the screen and the details are moved from table1 to table2.
Any thoughts please, this is mega urgent, but then arnt they always!
Question by:123dec45
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
  • 3
  • 2
LVL 25

Expert Comment

ID: 20357672
You could always do this in one operation directly within the database.  Something like

 (init, surname, date, complete)
 init, surname, date, @completeValue
  ??? = ???

DELETE FROM tab1 WHERE ??? = ???

The question marks allow you to add your own where clause, as I don't know how you are identifying the records to move.

Second approach would be to use a server-side language.  Show all records from tab1 on the page with a submit button that copies the individual record to the second table, and then delete from tab1.  Which server-side language are you using?

Accepted Solution

mms_master earned 2000 total points
ID: 20357762

>"a sort would be nice perhaps by date"
You can sort your results by adding ORDER BY {field} {order}  replacing {field} with the field name and {order} with ASC for ascending order and DESC for descending order

> "with a radio button next to them so person2 can select with the radio button the record to retrieve"
You need to add a field in table 1 called "id", set the type to int, set it as the primary key and set it to auto increment.
Then add same field in table 2, but this time DONT set it to auto increment.
The value of the radio buttons can then be set to the id of the record. The id can then be passed to the next page in order to retrieve the right record.

I've given an example of the SQL queries you can use below (I done them off the top of my head and haven't tested them, if theres any problems or you need more help with them let me know). I couldn't give you the code for displaying the results as I don't know which language your pages are using. (i.e. php, asp etc)
Page 1:
Retrieve details:
SELECT id, surname, date FROM table1 ORDER BY date ASC
Page 2:
Retrieve details:
SELECT * FROM table1 WHERE id = {id passed from page 1}
Copy details to table2:
INSERT INTO table2(id, surname, date) VALUES({id passed from table 1}, {surname passed from table1}, {date passed from table1})
Delete details from table 1:
DELETE FROM table1 WHERE id = {id passed from page 1}

Open in new window


Author Comment

ID: 20357816
Thanks Rouchie
ASP was the plan, the reason i wanted 2 tables was more from a security side, in the real world, table 1 will have limited information, table 2 sensitive info. The auditors I know will be happier if I can lock down table 2 by usernames or groups rather than trying to do it progromaticaly.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 25

Expert Comment

ID: 20357871
Create a recordset in DW and list all the names from tab1.  Add a checkbox to each repeat region so that when the page is submitted the receiving page receives a list of check boxes that are checked,

  i.e. "5, 7, 8, 12, 15, 17"

SQL Server can accept this as a stored procedure argument and turn the numbers into a temporary table, which can then very easily be copied over to tab2.  The first job is to create the list of records from tab1.  See how you get on with that and we'll take it from there!

Author Comment

ID: 20360781
Thanks for the ideas, will give both a try and be back in the morning,.

Author Closing Comment

ID: 31411177
Nice... Sorry its taken some time to get back, always firefighting !!Worked like a drema, thanks for your help

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

764 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