1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access vba

Discussion in 'Business Applications' started by karlhaywood, Dec 28, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. karlhaywood

    karlhaywood Account Closed Thread Starter

    Joined:
    Jan 17, 2010
    Messages:
    680
    Hi,

    i need some help with vba. i have created a query to check whether a job as gone past its "expected completion date" That works fine and it give me the correct results. I need some vba to check through the table and give me a message box of how many jobs have gone past the finish date.

    Thanks.
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You just need a Recordset based on your Query with the message
    msgbox "There are " & rs.recordcount & " jobs past their completion dates"
    where rs is the recordset.
     
  3. karlhaywood

    karlhaywood Account Closed Thread Starter

    Joined:
    Jan 17, 2010
    Messages:
    680
    I have actually got some code that used the DLOOKUP, but i cant get it to work. Take a look at the attached file.
     

    Attached Files:

  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    It is much easier with the query, because you can run it and check the number of records, plus it will probably be used for your form to display the records anyway.
     
  5. karlhaywood

    karlhaywood Account Closed Thread Starter

    Joined:
    Jan 17, 2010
    Messages:
    680
    Check the code in the attached file. You actually wrote this, bit i cant get it to work.
     

    Attached Files:

  6. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    What does it do?
    There is a line missing, after the Else there should be
    intStore = rs.recordcount

    But that isn't actually using your query.
     
  7. karlhaywood

    karlhaywood Account Closed Thread Starter

    Joined:
    Jan 17, 2010
    Messages:
    680
    On Load it should look throught the database check for jobs past the expected completion date give me a message boxwith the count of jobs and then open the reminders form.
     
  8. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Did you add the line of code?
     
  9. karlhaywood

    karlhaywood Account Closed Thread Starter

    Joined:
    Jan 17, 2010
    Messages:
    680
    i would do but the database is on my external hard drive and im in Wales lol i will do as soon as i get back.
     
  10. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/971200

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice