Results 1 to 3 of 3
  1. #1
    Icewolf0927 is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    13

    Error with Do While Loop

    Hi
    I have this loop running until a count down reaches 0. It runs fine until it hits zero I think the problem is that the field doesn't exist at this time.

    What I am doing is I am trying to automatting when an email goes out. It has to go through a list of adjudicators and send the report out for each one. I have it update the table when the report get sent out. It works like it is suppose to till all of them are sent out. It gives me a run time error 2427 You entered and expression that has no value. Here is the code
    Code:
    Do
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "send_email_qry"
    Me.Auto_name.Value = DLookup("MinOfName", "Email_Sent")
    Me.adj_name.Value = Me.Auto_name.Value
    Me.Adj_email.Value = DLookup("[Email]", "[Adjudicator]", "[Auto_Name] = [Adjudicator]![Name]")
    DoCmd.SendObject acSendReport, "Inv_Production", acFormatPDF, [Forms]![Main_dashboard]![Adj_email], , , "Production Report for " & [adj_name], "Hi please review your production report for " & DateAdd("d", -7, Date) & " And " & Date, No
    DoCmd.OpenQuery "update_sent_email"
    Me.Count_foremail.Requery
    DoCmd.SetWarnings True
    Loop While [Forms]![Main_dashboard]![Count_foremail].[Form]![Count] > 0
    MsgBox "Emails have been sent out for " & Me.team_combo, vbOKOnly, "Email Sent"
    I have also added what the screen looks like.



    Thanks
    Andy
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Maybe:

    Do While Not IsNull(Forms]![Main_dashboard]![Count_foremail].[Form]![Count])
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Icewolf0927 is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    13
    Thank you so much that worked. You know I was thinking that but wasn't sure how to write the code. Thanks again for your help

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error Handling Loop...Stuck Inside!
    By Soule in forum Programming
    Replies: 4
    Last Post: 02-23-2012, 07:10 PM
  2. Help with a For Loop in VB
    By JFo in forum Programming
    Replies: 5
    Last Post: 09-29-2011, 02:45 AM
  3. New tables created in a loop causing error
    By shubhamgandhi in forum Programming
    Replies: 2
    Last Post: 07-20-2011, 05:16 PM
  4. Replies: 8
    Last Post: 05-16-2011, 06:01 PM
  5. Error: Loop without Do
    By eric.opperman1@gmail.com in forum Programming
    Replies: 4
    Last Post: 01-25-2011, 02:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums