Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / February 2007

Tip: Looking for answers? Try searching our database.

This morning, this code quit working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ricter - 22 Feb 2007 14:42 GMT
Private Sub VendorChqNum_AfterUpdate()

  Dim DateToUse As Variant
 
  If IsNull(Me.VendorChqDate) And Not IsNull(Me.VendorChqNum) Then
   DateToUse = DLookup("[VendorChqDate]", "tblInvoices", "[VendorChqNum]='"
& _
   Me.VendorChqNum & "'")
       Me.VendorChqDate = DateToUse
   ' DateToUse = ""
   
   Else: Exit Sub
   
   End If

If Me.NewRecord And IsNull(PONum) Then
 PONum = Me.Parent!PONum
 Else
 End If
 
End Sub

Has been working for months.  Any ideas why this code would "up and quit"?  
I haven't changed a thing for weeks.

Thanks.
Jerry Whittle - 22 Feb 2007 15:09 GMT
How did it quit? Error message? Not updating things?

Just because you didn't change anything doesn't mean that someone else
didn't. Do you have automatic updates enables? Microsoft often releases bug
fixes and patches on Tuesday evenings. Is your computer a stand-alone or on a
network controlled by IT people?
Signature

Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

> Private Sub VendorChqNum_AfterUpdate()
>
[quoted text clipped - 22 lines]
>
> Thanks.
Ricter - 22 Feb 2007 15:17 GMT
Sigh, I'm such a n00b, all excellent questions, Jerry.

In the meantime I looked at the table and found a lot of instances where the
vendor cheq number had been initally entered without a date.  So the records
returned later, on the Dlookup, contained a lot of "empties".  I updated the
table, and now the code is working.  Thanks, Jerry.

> How did it quit? Error message? Not updating things?
>
[quoted text clipped - 29 lines]
> >
> > Thanks.
Pat Hartman (MVP) - 26 Feb 2007 21:34 GMT
This makes me think that you are using the wrong function.  The Dlookup()
function will return an ARBITRARY record when multiple records match the
selection criteria - check the help entry for details since you may not be
getting what you expect in all cases.
If you are interested in the most recent date for a check number, you should
be using DMax().

> Sigh, I'm such a n00b, all excellent questions, Jerry.
>
[quoted text clipped - 43 lines]
>> >
>> > Thanks.
Jason Lepack - 22 Feb 2007 15:12 GMT
Define "Quit Working".
Error message?  Post it.
Doesn't look like it's doing anything?  Have you tried putting a
breakpoint in to see if it's actually getting to the code?

> Private Sub VendorChqNum_AfterUpdate()
>
[quoted text clipped - 22 lines]
>
> Thanks.
Pat Hartman (MVP) - 22 Feb 2007 15:18 GMT
What about it isn't working?

> Private Sub VendorChqNum_AfterUpdate()
>
[quoted text clipped - 23 lines]
>
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.