Update field w/ string based on due dates

Hi,

I have a form that provides a listing of various instruments that are
serviced on a monthly to  annual basis, with general info about the
instrument, last and next service dates, etc..

What I am trying to do is create an On Open event procedure that will
identify all
instruments that are listed with a string of either "Past Due" or
"Schedule Vendor" based on whether each of their respective 'Due'
dates have already transpired or not from the current month.

The code I initially created for this was as follows:


Private Sub Form_Open()
Dim myDate, myDue


myDate = DateSerial(Year(me.ListDate), Month(Me.ListDate), 1)
myDue = Me.NextServiceDate


If Me.Due < mydate then
    Me.Status="Past Due"
Elseif Me.Due >= mydate then
   Me.Status="Schedule Vendor"
End if

End Sub

This of course only updates the first 'Status' field on the list but
not the rest.  I know I probably need to code this under a Do...Loop
or For Each...Next  statement, but I simply cannot figure out the
right way to do this.


Any help would really be appreciated.


Regards,
Ruben

0
Ruben
5/19/2007 11:06:22 PM
access.forms 6864 articles. 2 followers. Follow

2 Replies
698 Views

Similar Articles

[PageSpeed] 22

Without knowing more about your table, I suspect everything can be done in a
query and eliminate the OnOpen code.  Have you looked into that?

Ruben wrote:
>Hi,
>
>I have a form that provides a listing of various instruments that are
>serviced on a monthly to  annual basis, with general info about the
>instrument, last and next service dates, etc..
>
>What I am trying to do is create an On Open event procedure that will
>identify all
>instruments that are listed with a string of either "Past Due" or
>"Schedule Vendor" based on whether each of their respective 'Due'
>dates have already transpired or not from the current month.
>
>The code I initially created for this was as follows:
>
>Private Sub Form_Open()
>Dim myDate, myDue
>
>myDate = DateSerial(Year(me.ListDate), Month(Me.ListDate), 1)
>myDue = Me.NextServiceDate
>
>If Me.Due < mydate then
>    Me.Status="Past Due"
>Elseif Me.Due >= mydate then
>   Me.Status="Schedule Vendor"
>End if
>
>End Sub
>
>This of course only updates the first 'Status' field on the list but
>not the rest.  I know I probably need to code this under a Do...Loop
>or For Each...Next  statement, but I simply cannot figure out the
>right way to do this.
>
>Any help would really be appreciated.
>
>Regards,
>Ruben

-- 
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200705/1

0
ruralguy
5/20/2007 1:54:52 AM
On May 19, 6:54 pm, "ruralguy via AccessMonster.com" <u12102@uwe>
wrote:
> Without knowing more about your table, I suspect everything can be done in a
> query and eliminate the OnOpen code.  Have you looked into that?
>
>
>
>
>
> Ruben wrote:
> >Hi,
>
> >I have a form that provides a listing of various instruments that are
> >serviced on a monthly to  annual basis, with general info about the
> >instrument, last and next service dates, etc..
>
> >What I am trying to do is create an On Open event procedure that will
> >identify all
> >instruments that are listed with a string of either "Past Due" or
> >"Schedule Vendor" based on whether each of their respective 'Due'
> >dates have already transpired or not from the current month.
>
> >The code I initially created for this was as follows:
>
> >Private Sub Form_Open()
> >Dim myDate, myDue
>
> >myDate = DateSerial(Year(me.ListDate), Month(Me.ListDate), 1)
> >myDue = Me.NextServiceDate
>
> >If Me.Due < mydate then
> >    Me.Status="Past Due"
> >Elseif Me.Due >= mydate then
> >   Me.Status="Schedule Vendor"
> >End if
>
> >End Sub
>
> >This of course only updates the first 'Status' field on the list but
> >not the rest.  I know I probably need to code this under a Do...Loop
> >or For Each...Next  statement, but I simply cannot figure out the
> >right way to do this.
>
> >Any help would really be appreciated.
>
> >Regards,
> >Ruben
>
> --
> HTH - RuralGuy (RG for short) acXP WinXP Pro
> Please post back to this forum so all may benefit.
>
> Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200705/1- Hide quoted text -
>
> - Show quoted text -

I have not looked into making it all work from within a query.  A
select query is what I am using as my underlying source for the
calculated date fields.  However, as records are updated and service
dates change, I don't know that the 'Status' field from within a query
can automatically update accordingly.

I am certainly open to any ideas.

Can you exlplain what you mean by "Please post back to this forum so
all may benefit".  I am new to this group and don't quite yet know the
ins and outs of how it all works.

Regards,
Ruben

0
Ruben
5/20/2007 2:28:30 AM
Reply:

Similar Artilces:

Update for MS Money 2005?
I have Money 2005. Is there an update to MS Money for Canadian users? Thanks in advance for any answers. We need a bit more information! Are you having problems with M2005 or is this just a post-Christmas/New Year random query when you are trying to get away from the in-laws? -- Regards Bob Peel, Microsoft MVP - Money For unofficial FAQs see http://money.mvps.org/ or http://umpmfaq.info/ I do not respond to any emails that I have not specifically asked for. "Daniel" <Daniel@discussions.microsoft.com> wrote in message news:E86EAB89-21DE-4505-ACAD-647278D736BD@microso...

updating sheets based on data in first sheet
Another payroll question, I have a workbook that contains 26 sheets, one for each bi-weekl payroll period. I would like to set it up so when i add a new employe the rest of the sheets also update automatically with that employee name and information. I have been able to acheive this to a limited degree using th =sheet1!a1 formula, but this only updates the info in the first cel and particularly the first column. I would like to acheive this using the first sheet, since at th end of the year I would like to be able to calculate ytd figure easily. Thank -- Message posted from http://www.Exc...

pivot table with dynamic base data
hiya, im trying to create a pivot table where I can change my base data (inserting or deleting rows of data) and still have this reflected in the pivot table. My solution was to use entire columns as my range for input to the pivotTable, but this means including blank rows which seems to muck up the calculations. I cant think how else i can allow for new rows to be added to the base data anyone got any ideas how to do this? thanks loads for your help! You can use a dynamic range as the source. There are instructions here: http://www.contextures.com/xlPivot01.html bb wrote: > hiy...

Problem with Script Updating
I am using a script to update the “1099 Type” field for Master Vendor table. The script basically is a basic if-then statement. This script is run “Before Document Commit” and it’s not updating correctly, its flip-flopping the results. When the script is set to run Before Document Commit I have the “Destination mapping” field “1099 Type” set to “Use Script”. Script below: If SourceFields("Send 1099") = "N" Then DestinationFields("Options.1099 Type").Value = 1 Else DestinationFields("Options.1099 Type").Value = 4 End If I have also tried this s...

PivotTable page field list- limiting what a user sees
Folks, I am creating an automotive Winter & All Season Tire listing. What I would like to provide from a pivottable is, from 3 page field items a user picks; 1) Type (Winter or All Season) 2) Rim size (13,14,15,16,17 or 18 inch) 3) a list of only those tires which meet the above What I am getting now from the drop dwon lists is; 1) Type works fine 2) shows 13,14,15,16,17,18 and then repeats 13,14,15,16,17,18 3) shows all tires sizes (which is above 30 items long instead of about 4-5) Any thoughts on how this might be done with VB etc. ...

Australian date format in Excel 2000
We have recently upgraded MSOffice97 to MSOffice2000. In Excel2000 I find that I cannot set the date format to the Australian date format, even though the Windows regional setting is set to English(Australian). How can you format cells to Australian date format? ---------- Brian Jones Our Lady of the Sacred Heart College Bentleigh Victoria Australia Hi Brian, Highlight the cells yo wish yto format, then; Format/Cells/Date then choose the format that suits your requirements. Cheers, Ken Russell kenrussellyourhat@optushome.com.au Remove yourhat to reply by e-mail .. "Brian Jones&q...

Date Range
I have created a query based on one table to search for dates in a certain range, for example May, by searching the date field with the criteria Between [enter start date] And [enter end date] It pulls up most records but always leaves excludes a few records which should be included. Previously all dates were in a different format, so I changed them all to d/m/yy. The date field in the table is text. Should it be changed to a date format? If this is an issue, why is it pulling up most of the fields? Thanks. Could you post the SQL you are using (or at least the criteria)? Also tel...

Multiple date select calender
I need a calender for MFC in which i can select multiple dates similar to what is there in calender of outlook 2003. Also I need the functionality to be able to select the days i.e. sunday, monday, etc. Is there some activex available freely which i can use. Or is it possible to achieve the same by subclassing the existing CMonthCalCtrl in MFC. Please guide me. Thanks in Anticipation Software Engineer wrote: > I need a calender for MFC in which i can select multiple dates similar to > what is there in calender of outlook 2003. Also I need the functionality to > be able to sel...

MS can't even get the release date right
Microsoft CRM has been a major disappointment in most every aspect. Now, they've failed again with the CRM product by delaying the CRM 2005 release until 4th Quarter. Some might say that this is a good thing so that it's a better product, but MS should have it more together than to announce a ship date they can't fulfill. Very frustrating that we have to continue on with this inferior version 1 product even longer. -- Brandon Smith IT Director Presentations Direct - Specialized Office Equipment & Supplies http://www.presentationsdirect.com So what causes you to ca...

Publisher 2007 and Microsoft Updates
I created a newsletter yesterday - everything fine - use Publisher all the time. Then an automatic update came down this morning and I can't open the file - it says "Publisher cannot open file" Other documents in Publisher are opening - any ideas? http://support.microsoft.com/kb/972566/ -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "Kim" <Kim@discussions.microsoft.com> wrote in message news:8754339B-99DC-4D09-83AD-6B34D8215274@microsoft.com... >I created a newsletter yesterday - everythin...

Microsoft Update only updates Windows Defender
iacrosoft Update only updates Windows Defender - I have to use Belarc Advisor to get a list of missing updates, and then go to the Microsoft Download Center to search for the missing updates and download and install them one at a time. I have Windows XP Home SP3, with Microsoft Update set to automatic download - can anyone tell me why I do not get all the necessary upadtes? Is this a sudden, new problem? When was Automatic Updates last working? Can you update manually via http://windowsupdate.microsoft.com? Any chance you've got a beta build of WinXP SP3 installed? What...

Update question
Soory if this is the wrong place to ask this, but cannot find a NG proper to Windows 7. I currently run Windows Vista and am getting tired of Vista's decision to tell me that it is going to shut down in less than a minute. So have decided to upgrade to Windows &. I note that I can purchase an upgrade versiom for 64 quid from Amazon or an apparently full version of Windows 7 Home premium for 89 quid. My question is this - If I buy the upgrade version will I only be able to load it on a new PC in the future if I already have windows Vista installed? i.e For any future cl...

Copy and Paste based on criteria
When Department changes I need to insert the ADDRESS below the Account-Institution Business Office:. Another option I have is that if address = get new address from page 2. HELP xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ending 02/13/10 Account-Institution Business Office: DEPT EMP.NBR EMPLOYEE NAME ADDRESS 883 27903 ROBERSON, JOE abc 883 119245 MUSIL, TODD E abc 883 Total ----------------------------------------------------------------- Account-Institution Business Office: DEPT EMP.NBR EMPLOYEE NAME ADDRES...

Outlook 2003 died mysteriously after update
Setup in a nutshell... System: Lenovo T500 laptop OS: Vista Business SP1 32-bit Software: Office Outlook 2003 SP3 Problem... So I'm using this setup for over a year, everything OK. Yesterday I did two things and now Outlook dies (quietly, sans error message) immediately after startup. It show the splash screen, displays my inbox, and *poof* disappears. What I did earlier... 1. Windows Update installed: KB9766662, KB979306, KB979099, KB975929 2. At the same time, while searching for another program to uninstall I stumbled upon (and uninstalled) Windows LIVE Toolbar and...

Adding two fields together
Does anyone have a solution how can I manage the following: Basic setup: Custom entity with many nvarchar attributes. I created a custom view and selected a filter and the fields I want to have. (I need to export those to Excel-sheet) The problem is that lets say I have attributes A and B, which are ofcourse shown as different fields in the view. What I want is to have them in the same cell in Excel (when I do export) and not in two different columns. Is there any easy way to achieve this without touching the entity itself? (or do I have to create a custom attribute C and some java script On...

How update entity in post update?
I created a handler for Update post callout for Opportunity. I want update some fields of the opportunity on the PostUpdate. However, if I call the Update method of CRMOpportunity in the PostUpdate I will create a recursive post callout. Can somebody help me? Thank you for pay attention []'s Vin�cius Pitta Lima de Ara�jo You need to check the OrigObjectXML field to see what fields were updated and then act appropriately. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On Wed, 4 Aug 2004 17:43:17 -0300, "Vin�cius ...

Cannot install update KB979906 for .NET Framework 1.1 SP1
Running : Windows XP media center edition SP3 Have tried installing KB979906 a few times and also downloaded update manually but cannot install this update. Receiving error 0x643.Is it safe to uninstall the .NET Framework 1.1 and re-install as possibly corrupt , without having to uninstall/re-install all other .NET frameworks 2 , 3 and 3.5 including the updates that go with them? .. Hello sherlockomes, you might want to look at the following kb article to see if this will help with the error 80070643. <http://windows.microsoft.com/en-US/windows-vista/Windows-Update-error...

When cells with dates don't format
I have some cells which contain dates. These dates are a link from another data source (Bloomberg) and when I try to formatt the cells, I cannot. They will only display the date in mm/dd/yyyy formatt. Any ideas? Thanks My first guess is that the cells are coming in as text. Look for an apostrophe (" ' ") in front of the data in the cell. If not, try using "text to columns" (select the entire column, click Data, Text to Columns, Finish). Then, attempt to re-format the cells (or entire column) as a date with the form that you want. Also, make sure ...

latest update too MSCFV2
Hi, I have MSCFV2 version 6.5.7825.0. Could someone inform me if this is the latest download? Looks like you have 6.5.7825.0 from 05/21/2006, but there is a newer version - 6.5.7831.0 from 06/01/2006. C. Smith Enso Technologies, Incorporated http://www.ensotech.com On Tue, 13 Jun 2006 04:25:02 -0700, Paul <Paul@discussions.microsoft.com> wrote: >Hi, > >I have MSCFV2 version 6.5.7825.0. Could someone inform me if this is the >latest download? Christopher Smith csmith@ensotech.com Enso Technologies, Incorporated http://www.ensotech.com Also - meant to post this in t...

Print record once, update Yes/No field verifiying print
I would like to print a group of records, then have a Yes/No field [Printed] updated in my Jobs table with an update query showing the records were printed. Then next time the report runs, In my query criteria I will test for True values on the Yes/No field. Then only the records with the Yes/No field marked No will print. Any suggestions? Thanks Tommyboy,there's more to this question than meets the eye. For an explanation of what's involved, see: Has the record been printed? at: http://allenbrowne.com/ser-72.html The article includes a free sample database that dem...

Dynamic Menu update
Hi All, I need to update a menu item dynamically, setting its SetCheck property to either true or false, based on a user operation. I am trying to do this from a custom function. Usually, the pCmdUI pointer is used. But how do I do it from another function? Thanks Your "other function" should change some setting. In your ON_UPDATE_COMMAND_UI handler, you should check that setting and call SetCheck as needed. -------------- Ajay Kalra ajaykalra@yahoo.com In addition to Ajay's response, this page may help you: http://msdn2.microsoft.com/en-us/library/6kc4d8f...

how to return a serial number to a date
Example: 40899 Is there a formula to convert the serial number 40899 above back to 12/22/2011? Thanks, Holly Format the cell as Date -- Biff Microsoft Excel MVP "Holly" <Holly@discussions.microsoft.com> wrote in message news:82F628DD-B506-4A72-B5AC-DF85265ADAB0@microsoft.com... > Example: 40899 > > Is there a formula to convert the serial number 40899 above back to > 12/22/2011? > > Thanks, Holly "Holly" wrote: > Is there a formula to convert the serial number 40899 > above back to 12/22/2011? It would h...

online updates for money2003(not updating)
Money gets its updates from spcomstock.com and the server has moved to a new site. The default site that money provides has to be changed. At this time I don't know how to do this. If I find out how to do this I will Post it. ...

Payroll Update
HI all, We are running GP 7.5. I installed SP7 and the July 2005 tax update for CDN payroll. Now out payroll administrator gets an error message: 'The modified version of P_Payroll registry is missing'. How do I fix this problem Thanks -- Henry ...

[ANN] Excel X security update
Hi All, A security update for Excel X was also released today: http://www.microsoft.com/mac/downloads.aspx?pid=download&location=/mac/d ownload/officex/ExcelX_Security_1017.xml&secid=5&ssid=17&flgnosysreq=Tru e Or at least: http://www.microsoft.com/mac/downloads.aspx Corentin -- --- Mac:MS MVP (Francophone) --- http://www.mvps.org - http://mvp.support.microsoft.com MVPs are not MS employees - Les MVP ne travaillent pas pour MS Remove "NoSpam" to e-mail me - Retirez "NoSpam" pour m'�crire ...