Results 1 to 4 of 4

Thread: Update current Record

  1. #1

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Update current Record

    Hi

    I have a label which contains an ID now what I want to do is
    update the current record if the label contains a value and if not
    insert a row....

    The code related to the condition is below
    VB Code:
    1. If (lblScaleEventID > 0) Or (ObjRSprodidvalues.EOF) Then
    2.         ObjRSprodidvalues.MovePrevious
    3.         ObjRSprodidvalues.Update
    4.      ElseIf (ObjRSprodidvalues.BOF) Then
    5.             Load frmvoidopid
    6.             frmvoidopid.Show vbModal
    7.            Else
    8.             ObjRSprodidvalues.MoveLast
    9.       End If
    10.        lblScaleEventID = ObjRSprodidvalues.Fields(0).Value

    I receive an error ' EOF or BOF is true' or record is deleted...

    Thanks for your help
    ** HOLLY **

  2. #2
    Hyperactive Member
    Join Date
    May 2003
    Posts
    401

    Re: Update current Record

    Originally posted by holly
    Hi

    I have a label which contains an ID now what I want to do is
    update the current record if the label contains a value and if not
    insert a row....

    The code related to the condition is below
    VB Code:
    1. If (lblScaleEventID > 0) Or (ObjRSprodidvalues.EOF) Then
    2.         ObjRSprodidvalues.MovePrevious
    3.         ObjRSprodidvalues.Update
    4.      ElseIf (ObjRSprodidvalues.BOF) Then
    5.             Load frmvoidopid
    6.             frmvoidopid.Show vbModal
    7.            Else
    8.             ObjRSprodidvalues.MoveLast
    9.       End If
    10.        lblScaleEventID = ObjRSprodidvalues.Fields(0).Value

    I receive an error ' EOF or BOF is true' or record is deleted...

    Thanks for your help
    Which part of the code containing EOF or BOF does the error pop up? In other words which line does the error show...
    Enjoy!!!
    apps_tech

  3. #3
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615

    Re: Update current Record

    Originally posted by holly

    ObjRSprodidvalues.MovePrevious
    ObjRSprodidvalues.Update
    These two lines of your code cousing this problem and doesn't make any sence.
    Why would you move to the previous record and update it in same time. There is no changes for record at this time. Why would you update it?

  4. #4

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Re: Update current Record



    Which part of the code containing EOF or BOF does the error pop up? In other words which line does the error show...



    Apps tech the error line is
    VB Code:
    1. If (lblScaleEventID > 0) Or (ObjRSprodidvalues.EOF) Then


    Originally posted by andreys
    These two lines of your code cousing this problem and doesn't make any sence.
    Why would you move to the previous record and update it in same time. There is no changes for record at this time. Why would you update it?
    There is a logical reason:

    The user enter a valid number but there is always a chance that
    they may enter the wrong number...This procedure uses a SP
    which validates this number and inserts the values into another
    table....the ID number is then placed into a label....

    so for example
    user enter 123456 instead of 123345 now because these two
    numbers are valid they will both be acknowledges and inserted
    into the table but the proble is 123456 should never of been
    entered.


    Hope thats clear
    ** HOLLY **

Posting Permissions

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



Click Here to Expand Forum to Full Width