Professional Web Applications Themes

MS Access d/b saved parameter query problem - ASP Database

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 ...

  1. #1

    Default 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

  2. #2

    Default 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

  3. #3

    Default Re: MS Access d/b saved parameter query problem

    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

    --
    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

  4. #4

    Default Re: MS Access d/b saved parameter query problem

    On Tue, 3 Aug 2004 15:20:41 -0400, "Bob Barrows [MVP]"
    <reb01501NOyahoo.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

Similar Threads

  1. Access date parameter problem
    By AHT Barry in forum Coldfusion Database Access
    Replies: 2
    Last Post: June 27th, 11:34 PM
  2. Problem evaluating text from within a cfmail tag usingthe query parameter
    By MikeyMike1981 in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: June 21st, 04:48 AM
  3. Query string and Parameter Passing Problem
    By Paul Gray via DotNetMonster.com in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: May 14th, 04:00 PM
  4. Another saved parameter query question (MSAccess XP)
    By Larry Rekow in forum ASP Database
    Replies: 2
    Last Post: August 5th, 02:47 AM
  5. Date Parameter For Saved Parameter Queries
    By melody in forum ASP Database
    Replies: 13
    Last Post: December 19th, 09:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139