Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2012
    Posts
    14

    Unanswered: Access Code Errors - can anyone please tell me where its going wrong?

    I have quite a bit of validation on my form but the part where it seems to be going wrong is with the Form_BeforeUpdate (I think!). This is what its supposed to be doing:
    Check all the controls with * in the tag to see if they're blank and check a booleon control (yes/no) called memoire_comp to see if its ticked. If the controls with * in tag or memoire_comp isn't ticked, then display the error (msgbox) and take the user to the field that needs completing:
    The error i'm getting is:
    Error 3021 No Current Record

    Can anyone please see what i'm doing wrong here? Or is there some other piece of code which is clearly wrong?

    Thanks you so very much for any help you can offer
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Can you compile the project without error?
    Have a nice day!

  3. #3
    Join Date
    Jan 2012
    Posts
    14

    ?

    I'm not compiling.. I just want it to be able to validate when a new record is added.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    yes thats fine
    but the question is does the code compile. Sinndho is suspecting there may be a module (form, report, code) which has a VBA error in it. so he is requesting t hat you check there are no compilation erorrs

    ..int he code window its either run or debug | compile
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    OK so where is the fault being reported?
    I'm not going to plough through god knows how many lines of code to to try and guess where you error is

    if you dont' knwo which line is reporting hte fault then put a watch /breakpoint in the first fucntion / sub / procedure that you run and then step through the code

    if you dont' knwo how to set a watch / breakpoint, then now is a very very good time to start learning about the debugging tools in Office VBA / Access

    just a comment about your code, there's no comments, there no brief description or what any functions or subs are supposed to do
    there's controls called command325 which those not familiar with your design haven't got a scooby is supposed to do / be
    the very fact that you have got to 325 controls is scary, unless this form has been heavily revised over time
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Even odder, I ran up a new db, with a couple of Text fields, one Yes/No field, and set up a Form using them, naming the Checkbox as memoire_comp and putting * in the Tag Property of two of the Textboxes, and pasted the Form_BeforeUpdate code into it, and immediately got a 'Module not Found' error when running the Form! Tried to Compile and got the same error.

    I then created another new file, imported the Table and Form, and everything ran as expected! I would point the finger at corruption, given that importing it into a new db resolved the issue, but how does code presumably

    • Copied from the OP's database
    • Pasted into a text file
    • Uploaded here as attachment
    • Downloaded by myself
    • Copied and Pasted into a new Access file

    bring corruption with it?

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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