robn
Posts: 70
|
Posted: 01/27/2009, 7:55 AM |
|
Hi
This is a strange one I'm trying to use an editable grid to insert multiple rows or results into a table. This I know is simple and straight forward to do normally but on this occasion its a bit different.
I have a questionair that I'm creating that has 10 questions on it.
What I am after doing is pulling in the questions from a QUESTIONS table which will populate the editable grid with the questions. Along with the question number and the Checklist type (I currently have two types). This there's an additional column which has a dropdown in it for the person filling in the form to be able to select a score.
I can get this to present no problem but the issue I have is that I need to insert the 10 questions results into the ANSWERS table therefore creating 10 new rows which include the score for each question, the question number, the checklist type and an Auditid (which I pass as the URL).
The problem is I can't get the data to insert. I've set a custom insert function pointing to the ANSWERS table. But as soon as I disable to Allow Update function the questions do not display on the screen. The only way I can get the questions to display is by having the Allow updates turned on but this then means the grid is trying to do an update not an insert.
Any help on how I can insert mutiple rows of NEW data into the ANSWERS table would be greatly appreciated.
Kind regards,
Robn
|
|
|
mljonzs
Posts: 124
|
Posted: 01/27/2009, 8:20 AM |
|
Hi robn,
Not sure if this is the best way or not, but have you tried to use the BeforeExecuteUpdate event for this? In here, if you want to add a new record with the current data, rather than try an update, you could disable the update setting the Grid's execution command to False
Grid.DataSource.CmdExecution = False
Then build a custom insert statement into your answers table. Something like:
Dim sql
sql = "INSERT......" --put your custom insert statement here
DBObj.Execute sql
Let me know if this works for you.
_________________
What does not begin WITH God, will end in failure!
|
|
|
|