Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Record

Status
Not open for further replies.

richvalve

Programmer
Mar 2, 2001
20
GB
Hello All

I have added a 'Insert Record' feature to my Ultradev site that works well.

The only slight 'mhhhh' with it, is the moment, you go to 'insert new record' and you type over the old data (the 1st record) if you know what I mean.

This is no major trauma, as only the 'admin' would see this, but I wondered if / how I would make it so that when I goto insert a user, the insert form is blank to start with.

Many thanks in advance

Richard
 
Hi Richard,

I'm guessing you created a recordset - then bound the table cells with the recordset.

The initial value should be nothing, blank, in fact it could have value not even on the html tag.

There are a few methods to do a insert record behavior.

First, put your cursor wherever you want it to be on the page, click insert - then live data (is it?), then pick insert record.

This will then prompt you to use what connection, what table, and you can deselect fields you do not want. - and a redirect page to boot.

Hit okay, and it'll do it all for you.

Or.

Set up the fields as you would like, rename the text fields as the recordset fields - like fldName would equal fldName in the recordset. Put in a submit button.

And I always click once on the submit button, open server behaviors, click the + select insert record. It will pop up a form where you just need to match up the form fields to the recordset fields - oh you need to specify the connection and table as well.

Click ok, and it's done.

The third method is to find extensions, or hand code it.

"Insert witty remark here"

Stuart
 
Thanks a lot Stuart

I don't think I made myself clear. I've created an 'insert records' page... but whenever I goto insert, the 1st record info shows.... and this is overwritten by the new data.

I wondered if there was a way of having a purley blank (from a graphical point of view) form to overwrite.

Thanks anyway

Richard
 
It sounds like you have copied your "update record" page and changed the behaviour to "insert record".

Go through each of the fields on your form and set the initial value to nothing. They will probably have recordset values in them at the moment. Derren
[Mediocre talent - spread really thin]
 
That rings a bell Darren!

Thanks for that. I shall go home and try it, I'm pretty sure that's it!

Cheers!

Richard
 
If I understood correctly, to start on a new row with no previous data in it would be:

recordSet.AddNew

This would create a new row that would then be able to insert other records. Don't forget to define your field names in your table to match with the field names in your database to make sure they go to the right field! ;o)

Candie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top