Re: Updating record EOF
From: Ed Richter (erichter1_at_frontiernet.net)
Date: 03/15/05
- Next message: A J Hackler: "FP2000 vs FP2003"
- Previous message: Murray: "Re: ftp vs http"
- In reply to: Thomas A. Rowe: "Re: Updating record EOF"
- Next in thread: Thomas A. Rowe: "Re: Updating record EOF"
- Reply: Thomas A. Rowe: "Re: Updating record EOF"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 15 Mar 2005 18:38:39 -0500
OK, that's what I thought you meant. Good idea?
Just curious though, I can understand how your suggestion would work, but
can you not use the EOF test in conjunction with a database update operation
like I tried to do?
"Thomas A. Rowe" <tarowe@mvps.org> wrote in message
news:eExaoFRKFHA.2136@TK2MSFTNGP14.phx.gbl...
>I would do something like the following:
>
> Set objRS = Server.CreateObject("ADODB.Recordset")
> strSQL = "SELECT * FROM Current_schedule WHERE (Sec_L_Name = '" &
> Rater_last & "' AND Home = '" & Home_team & "' AND G_Date = #" &
> Date_match & "# )"
> objRS.Open strSQL, objConn
>
> If Not objRS.EOF Then
> Set schObj = objConn.Execute ("UPDATE Current_schedule SET Post_2nd_Ref =
> '" & ref_ID & "' WHERE (Sec_L_Name = '" & Rater_last & "' AND Home = '" &
> Home_team & "' AND G_Date = #" & Date_match & "# ) ")
> End If
>
> objRS.close
> Set objRS = nothing
>
> --
> ==============================================
> Thomas A. Rowe (Microsoft MVP - FrontPage)
> WEBMASTER Resources(tm)
> http://www.ycoln-resources.com
> FrontPage Resources, WebCircle, MS KB Quick Links, etc.
> ==============================================
> To assist you in getting the best answers for FrontPage support see:
> http://www.net-sites.com/sitebuilder/newsgroups.asp
>
> "Ed Richter" <erichter1@frontiernet.net> wrote in message
> news:e8pc$pQKFHA.3484@TK2MSFTNGP12.phx.gbl...
>> So just reverse the order of the two lines?
>>
>> Do I first query for the record based on same criteria, if found execute
>> the update. If not found, then EOF? And by doing so, would place the EOF
>> (and query) ahead of the update?
>>
>>
>> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
>> news:eWOCUjQKFHA.1392@TK2MSFTNGP10.phx.gbl...
>>> You need to check for the record prior to doing the update. If the
>>> record exist, then do the do the update.
>>>
>>> --
>>> ==============================================
>>> Thomas A. Rowe (Microsoft MVP - FrontPage)
>>> WEBMASTER Resources(tm)
>>> http://www.ycoln-resources.com
>>> FrontPage Resources, WebCircle, MS KB Quick Links, etc.
>>> ==============================================
>>> To assist you in getting the best answers for FrontPage support see:
>>> http://www.net-sites.com/sitebuilder/newsgroups.asp
>>>
>>> "Ed Richter" <erichter1@frontiernet.net> wrote in message
>>> news:%23LwLdRQKFHA.656@TK2MSFTNGP14.phx.gbl...
>>> I'm attempting to update a record. The query was working OK, however
>>> there are some situations where a person may have entered some incorrect
>>> data, thus not finding a matching record. In case that happend I added
>>> the EOF statement and have added some code below to take care of what to
>>> do. However as soon as I added the EOF, I got the following error about
>>> object being closed?? If the schObj object is closed, I can't
>>> understand how it was open one line prior, before I added the EOF
>>> statement. Can you not use EOF when updating? Something else casuing
>>> the error?
>>>
>>> Set schObj = objConn.Execute ("UPDATE Current_schedule SET Post_2nd_Ref
>>> = '" & ref_ID & "' WHERE (Sec_L_Name = '" & Rater_last & "' AND Home =
>>> '" & Home_team & "' AND G_Date = #" & Date_match & "# ) ")
>>>
>>> line 221>> If schObj.EOF = true then
>>>
>>>
>>> ADODB.Recordset error '800a0e78'
>>>
>>> Operation is not allowed when the object is closed.
>>>
>>> /sports_ref_ratings/rating_submit.asp, line 221
>>>
>>>
>>
>>
>
>
- Next message: A J Hackler: "FP2000 vs FP2003"
- Previous message: Murray: "Re: ftp vs http"
- In reply to: Thomas A. Rowe: "Re: Updating record EOF"
- Next in thread: Thomas A. Rowe: "Re: Updating record EOF"
- Reply: Thomas A. Rowe: "Re: Updating record EOF"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|