Ask a Question related to ASP Database, Design and Development.
-
Larry Rekow #1
MS Access d/b saved parameter query problem
Trying to convert a page that adds records to a table. Have
successfully done it (to a point) using the "saved parameter query".
At first it didn't work, kept getting a "page not found" when
submitting the new data, so i went back and started revising the query
and the asp page to add one parameter at a time.
It appears that as soon as I add a field that is a number field, I get
the "page not found" error.
does one have to do something different with number fields? It worked
fine before when I used the Execute method.
Thanks.
Larry Rekow
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
Larry Rekow Guest
-
Access date parameter problem
I have been struggling with this for days. I am using a form to retrieve a list of dates and of store numbers. The user selects a date and store... -
Problem evaluating text from within a cfmail tag usingthe query parameter
Hi I'm trying to decrypt a string using text returned from a query and wondered if anyone knows what I need to do... I've tried adding <pre>... -
Query string and Parameter Passing Problem
Hi In the context of a Master/Detail scenario, I am having trouble figuring out the correct syntax for passing a parameter in a query string in a... -
Another saved parameter query question (MSAccess XP)
Trying to retrieve a recordset using a saved parameter query in Access. the query is named "resultsq1x" works fine when i run it within access: ... -
Date Parameter For Saved Parameter Queries
Hi again, I finally got to using saved parameter queries in my application (a big thank you to Bob Barrows for helping me with this). Currently... -
Larry Rekow #2
Re: MS Access d/b saved parameter query problem
After further testing, I think I have a clue to the problem.
I put some logic into this variable so that it would say "null" if it
were 0
in otherwords, the variable I setup looks like:
strkilos = Request.Form("kilos")
if strkilos = "" then
strkilos = " Null "
else
strkilos = "#" & strkilos & "#"
end if
but using the "saved parameter query", I get an error if the field is
empty. Will this work if I change the "if" statement somehow??
Thanks,
Larry Rekow
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
Larry Rekow Guest
-
Bob Barrows [MVP] #3
Re: MS Access d/b saved parameter query problem
Larry Rekow wrote:
Can't say without seeing the code that actually calls the query. Some> After further testing, I think I have a clue to the problem.
>
> I put some logic into this variable so that it would say "null" if it
> were 0
>
> in otherwords, the variable I setup looks like:
>
> strkilos = Request.Form("kilos")
> if strkilos = "" then
> strkilos = " Null "
> else
> strkilos = "#" & strkilos & "#"
> end if
>
> but using the "saved parameter query", I get an error if the field is
> empty. Will this work if I change the "if" statement somehow??
>
details about the table structure wouldn't hurt either (relevant field names
and datatypes).
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Larry Rekow #4
Re: MS Access d/b saved parameter query problem
On Tue, 3 Aug 2004 15:20:41 -0400, "Bob Barrows [MVP]"
<reb01501@NOyahoo.SPAMcom> wrote:
++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++>Larry Rekow wrote:>>> After further testing, I think I have a clue to the problem.
>>
>> I put some logic into this variable so that it would say "null" if it
>> were 0
>>
>> in otherwords, the variable I setup looks like:
>>
>> strkilos = Request.Form("kilos")
>> if strkilos = "" then
>> strkilos = " Null "
>> else
>> strkilos = "#" & strkilos & "#"
>> end if
>>
>> but using the "saved parameter query", I get an error if the field is
>> empty. Will this work if I change the "if" statement somehow??
>>
>Can't say without seeing the code that actually calls the query. Some
>details about the table structure wouldn't hurt either (relevant field names
>and datatypes).
>
>Bob Barrows
Thanks Bob. I was able to correct the problem by changing the way i
created the variable to simply:
strkilos = Request.Form("kilos")
if strkilos = "" then
strkilos = Null
end if
In otherwords, I just had to remove the quotation marks from around
the word Null, and it works both when there is a number in the field
and when there is not.
Below is the way I'm calling the query, and I still think it may not
be the most elegant, but here goes:
Set objHamDB=Server.CreateObject("ADODB.Connection")
objHamDB.ConnectionTimeout=60
objHamDB.Open import_entry
Set recordSet=Server.CreateObject("ADODB.Recordset")
recordSet.Open "SELECT (max(reference)+1) as MyMax FROM AIRFREIGHT",
objHamDB
newnum=recordSet("MyMax")
recordSet.Close
Set recordSet=Nothing
objHamDB.qAAR strawb, strshipper, strconsignee, strpcs, strkilos,
strcommodity, strdest, stretd, streta, strlast_flight, strremarques,
strcustoms, strarrived, strbilled, newnum, pnow, struser
objHamDB.Close
Set objHamDB=Nothing
For reasons I needn't go into, I can't use the autonumber feature for
my file numbers, so I briefly create a recordset to obtain the highest
number, then add one and create the variable "newnum"
Perhaps you can advise a better way to do this, tho the above is
working for me now ok.
Thanks again. I've been going thru this application I created some
time ago and I'm trying to convert things over to the "saved parameter
method" to make it more efficient, and to get more familiar and
comfortable using this method.
Larry Rekow
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
Larry Rekow Guest



Reply With Quote

