Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Mar 2009
    Posts
    24

    Unanswered: Run TIme Error 2115

    Hi Guys, I am getting run time error 2115. The error only occurs when I change the value of Me!SalesType. Deubg highlights the line that is Bolded below, the field is text, and allows zero length.

    All suggestions are welcomed.

    Private Sub SalesType_AfterUpdate()
    hSalesType = Me!SalesType

    End Sub

    Private Sub SalesType_BeforeUpdate(Cancel As Integer)
    If Not IsNull(hSalesType) And hSalesType <> "" Then
    Me!SalesType.Value = hSalesType
    End If

    Thank you,
    Trudye

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    What's the error text please?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Mar 2009
    Posts
    24
    Thank you so much for asking, it just dawned on me that it might be wise to post the error text (DUH):

    Here is the text:
    The Macro of function set to the BeforeUpdate or ValidationRule property for this field is preventing MS Access from saving the date in the field.

    Thanks again,
    Trudye

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    The logic here is:
    - As someone is just about to update a control, you change the value of that control.

    That doesn't make much sense eh? What (in natural English) do you want to happen?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2009
    Posts
    24
    Thanks for responding so quickly.

    What I am trying to accomplish is to get the field to maintain its value until the user changes that value. For instance if the User enters 1234 then 1234 would reappear in the ‘sales Type’ field until the user changes the value to let's say 4567 then 4567 would appear in every subsequent record until the user changed the value again.

    Not sure I did a great job of explaining that, if not please let me know.

    Thanks again,
    Trudye

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ok - so the user is creating new entries? Or is (s)he editing existing? Can they go forwards AND backwards through the data? If they can, what do you want to happen if they start going backwards?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Actually, I think I know the answer to some of the above (reading your code...). You only set the value if it is empty correct?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  8. #8
    Join Date
    Mar 2009
    Posts
    24
    Yes, the user is creating new entries, this is strictly a data entry screen.

    If the user chooses to view/edit a previous record and they change the Sales Type then the hSalesType should be updated. If the next record requires a different sales type then the User will have to enter the sales type associated with the current record.

  9. #9
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ok - sorry for the long journey. I assume hSalesType is a variable?

    Code:
    Private Sub SalesType_AfterUpdate()
    
         hSalesType = Me!SalesType
    
    End Sub
    
    Private Sub OnCurrent()
    If hSalesType > "" Then
        Me!SalesType.Value = hSalesType
    End If
    Testimonial:
    pootle flump
    ur codings are working excelent.

  10. #10
    Join Date
    Mar 2009
    Posts
    24
    Just a question or two.
    What event calls the OnCurrent procedure? Also why not just put the code in the calling event?

    Thanx,
    Trudye

  11. #11
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    On current occurs as soon as you navigate to a record\ create a new one. I'm afraid I don't understand your second question - could you rephrase please?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  12. #12
    Join Date
    Mar 2009
    Posts
    24
    On second thought it's not such a smart question. Thank you so much pootle flump for your time and patience.

    Trudye

  13. #13
    Join Date
    Mar 2009
    Posts
    24
    I hate to bug you but I got the following error;

    Member already exists in an object module from which the object module derives. What am I doing wrong?

  14. #14
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I suspect you already have a procedure to handle the OnCurrent event. Perhaps search for that?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  15. #15
    Join Date
    Mar 2009
    Posts
    24
    That was the first thing I checked, I did a find on 'current' and got no hits.

    I have not fields with the word current in them. I'm not even using the Form_current event.

    Do you have any ideas where else I should be looking?

    Thanks
    Trudye

Posting Permissions

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