CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 Reusing a Recordset

Print topic Send  topic

Author Message
Anthony Trotter
Posted: 05/30/2001, 9:22 AM

I am trying to reuse the data I received from an RS I used earlier in
my form to send 2 emails. Everything works fine with the email that
uses Request.Form("form_name"), but I can't seem to successfully
complete a lookup.

I set the RS (newrefRec) in the Form "Before Show" event that does the
following:
--------------------------------------------
set refRec = cn.execute("SELECT MAX(user_id) as MaxID from users WHERE
Active = " & true & ";")
Randomize
randref = Int(Rnd*(refRec("MaxID")) + 1)
set newrefRec = cn.execute("SELECT * FROM users WHERE user_id = " &
randref & ";")
fldrefby_id = newrefRec("user_login")
--------------------------------------------

I am trying to access this RS in the Form "After Insert" Event, but I
am getting errors:
--------------------------------------------
Action > Set tempRec = cn.Execute ("SELECT * FROM users WHERE
user_login = " & newrefRec("refby_id") & ";")
Error > Type mismatch: 'newrefRec'
--------------------------------------------
Action > Set tempRec = cn.Execute ("SELECT * FROM users WHERE
user_login = " & getParam("refby_id") & ";")
Error > No value given for one or more required parameters.
--------------------------------------------
Action > Set tempRec = cn.Execute ("SELECT * FROM users WHERE
user_login = " & fldrefby_id & ";")
Error > No value given for one or more required parameters.
--------------------------------------------

Thanks ahead of time.

Anthony



CodeCharge
Posted: 05/31/2001, 1:23 AM

Anthony,

It happens because "Before Show" event and "After Insert" event are used in
different scope and they work during different requests to the server.
Yuo may solve this problem in two ways:
1. You may create the session variable for "Before Show" event.
Use the following in Before Insert event after your code:
Session("refby_id") = newrefRec("user_login")
and in Before Insert event:
Set tempRec = cn.Execute ("SELECT * FROM users WHERE user_login = " &
Session("refby_id") & ";")

2. Or if you do not want to use the session you can create a non DB-based
hidden "refby_login" field in the form and in "Before Show" event use:
fldrefby_login = newrefRec("user_login")
and in "Before Insert" event:
Set tempRec = cn.Execute ("SELECT * FROM users WHERE user_login = " &
getParam("user_login") & ";")

Alexander



"Anthony Trotter" <support@worldnetcity.com> wrote in message
news:9f36nd$e2l$1@mail.tankhill.com...
> I am trying to reuse the data I received from an RS I used earlier in
> my form to send 2 emails. Everything works fine with the email that
> uses Request.Form("form_name"), but I can't seem to successfully
> complete a lookup.
>
> I set the RS (newrefRec) in the Form "Before Show" event that does the
> following:
> --------------------------------------------
> set refRec = cn.execute("SELECT MAX(user_id) as MaxID from users WHERE
> Active = " & true & ";")
> Randomize
> randref = Int(Rnd*(refRec("MaxID")) + 1)
> set newrefRec = cn.execute("SELECT * FROM users WHERE user_id = " &
> randref & ";")
> fldrefby_id = newrefRec("user_login")
> --------------------------------------------
>
> I am trying to access this RS in the Form "After Insert" Event, but I
> am getting errors:
> --------------------------------------------
> Action > Set tempRec = cn.Execute ("SELECT * FROM users WHERE
> user_login = " & newrefRec("refby_id") & ";")
> Error > Type mismatch: 'newrefRec'
> --------------------------------------------
> Action > Set tempRec = cn.Execute ("SELECT * FROM users WHERE
> user_login = " & getParam("refby_id") & ";")
> Error > No value given for one or more required parameters.
> --------------------------------------------
> Action > Set tempRec = cn.Execute ("SELECT * FROM users WHERE
> user_login = " & fldrefby_id & ";")
> Error > No value given for one or more required parameters.
> --------------------------------------------
>
> Thanks ahead of time.
>
> Anthony
>
>
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.