Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246

    Unanswered: GoTo Record in error

    Hi,
    I have a piece of code as follows that detirmines whether a field has been filled in on a continuous form.

    If IsNull(Forms!Security_subform!comments_code) Then
    Beep
    MsgBox "You have not entered a Comment Code, please enter one.", vbCritical, "Data not entered"
    DoCmd.GoToControl "Comments_code"

    ElseIf IsNull(Forms!Security_subform!Chaser) Then
    Beep
    MsgBox "You have not entered who is currently chasing this item, please enter one.", vbCritical, "Data not entered"
    DoCmd.GoToControl "Chaser"

    Else: DoCmd.RunMacro "Chk_Chase_macro"
    End If


    What I want to do is go to the record in error, can someone point me to how I can achieve this

    Regards
    John
    Last edited by Sticker; 05-13-04 at 10:31.

  2. #2
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    ^ Bump, anyone out there know??

  3. #3
    Join Date
    Jul 2003
    Posts
    73
    I'm not sure if this would work - but try:

    Code:
    If IsNull(Forms!Security_subform!comments_code) Then
    Beep
    MsgBox "You have not entered a Comment Code, please enter one.", vbCritical, "Data not entered"
    'DoCmd.GoToControl "Comments_code" - I commented this out
    comments_code.SetFocus
    ' If this doesn't work - you many need to qualify - Forms!Security_subform!comments_code.SetFocus
    
    ElseIf IsNull(Forms!Security_subform!Chaser) Then
    Beep
    MsgBox "You have not entered who is currently chasing this item, please enter one.", vbCritical, "Data not entered"
    ' DoCmd.GoToControl "Chaser" - I also commented this out
    Chaser.SetFocus
    
    Else: DoCmd.RunMacro "Chk_Chase_macro"
    End If
    Again - I'm not sure if it will work - but I've never used DoCmd.GoToControl - I always use SetFocus - and it seems to know which record in the continuous form you're looking at.
    Joel Dixon
    Analyst Programmer
    Melbourne, Australia

  4. #4
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Thanks Joel, I'll give it a go.

    How is sunny Melbourne?

    Regards
    John

  5. #5
    Join Date
    Jul 2003
    Posts
    73
    No worries.

    LOL - Sunny Melbourne - that's a good one! It was specifically amusing this morning - as I've just walked through some very annoying rain from the station to work.

    Good Luck with the code - let me know how it goes.
    Joel Dixon
    Analyst Programmer
    Melbourne, Australia

Posting Permissions

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