Put all the logic for determining whether your dealing with new or existing
user data in the user details page. In the SCR page, just use a link to the
user details page that passes the SCR user name in the query string. e.g.:
In ther user details page, query the db based for data on the specified
user. If you get back any data, pre-populate all the controls with data on
the user. If you don't get back data from the db, leave all the controls
blank except for the user name (which you can populate with the value
received from the query string).
Don't bother flagging the row as an insert or update at the time of the
initial read from the db. Even if it's a new row when the page is initially
loaded, it might not be by the time it's saved (i.e.: another user may have
added data against the same user name in the interim). Just add logic to
the code that saves the edited data to the db to update/insert as necessary
at the time of the actual save.
"Vivista Eastbourne" <aa.a> wrote in message
news:3f82b41f$0$130$7b0f0fd3mistral.news.newnet.c o.uk...as> Hi
> I have 2 tables, one called SCR and one called userdetails
> SCR table contains details of a change
> Userdetails contains information about a user
> All the data is entered via asp on our intranet
> One of the SCR fields is Username
> One of the Userdetails fields is also Username
> Both tables currently have a seperate asp form (by request from above)
> How can I check if the value entered for username on the SCR form existsthe> a username value in the Userdetails form, and if it does, bring up the
> record for that username, or if not, open up the blank form.
> Bear in mind that the forms already exist, just really need pointers on> code.
> Any help is (as always) greatly appreciated
> Many Thanks if you can help (you were all newbies once upon a time)
> Andy G