Kamis, 27 Maret 2014

[MS_AccessPros] Re: Help with message on openning & closing form

 

Good Evening John,
After visiting client, I discovered one of the subforms is becoming dirty and causing the issue.  I will be troubleshooting the process to see if I can discover why.  Not sure if it is getting dirty on loading or exiting the taxpayer form.  One thing is that the subform is not visible with the taxpayer form unless there is associated data.  Not sure if that make sense.  The subform represents the taxpayer protesting a billing.  The protest subform is display only if the protest checkbox on the billing form has been set true.
So I will be doing some more investigating this weekend.
Rod



---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Rod-

You don't say which form has the buttons.  frmTaxPayerDialog?  And what's the code behind the third button?

Two comments on the code:

1) acSaveNo turns off saving any *design* changes.  It does not prevent saving any data changes.

2) You don't show what AuditChanges does, but if that code needs to cancel the update, you have to pass it the Cancel variable.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Mar 27, 2014, at 3:55 AM, <desertscroller@...> <desertscroller@...> wrote:

Hi John, thanks for the reply.  The message is generated by my application code.  It appears that something is causing the form to get "dirtied" as you indicated.  The form's record source is a table "tblTaxPayer".  Each of the buttons apply a different filter:
    1.     One button selects all taxpayers assigned to the user (logged in)
                      rptFilter = ""
                      rptFilter = "(lngUserID = " & GetLoggedUser() & ")"
                     DoCmd.Close acForm, "frmMainDialog", acSaveNo
                     'DoCmd.OpenForm "frmTaxPayerDialog", acNormal, "", rptFilter
     2. Second button selects all taxpayers in the table (no filter)
                      rptFilter = ""
                      DoCmd.Close acForm, "frmMainDialog", acSaveNo
                     'DoCmd.OpenForm "frmTaxPayerDialog", acNormal, "", rptFilter
     3. Third button selects an individual taxpayer; either by - id, license, or name
The form has a BeforeUpdate event as does each subform associated with the taxpayer form.  The event for taxpayer form is as follows:
================================================
Private Sub Form_BeforeUpdate(Cancel As Integer)
   Dim varTPTID As Variant
   Dim strTPTNo As String

   'If the form data has changed a message is shown asking if
   'the changes should be saved. If the answer is no then
   'the changes are undone
 
   On Error GoTo BeforeUpdate_Error
   If MsgBox("Do you want to save this record?", _
              vbYesNo + vbQuestion, "Save Record") = vbNo Then
         Me.Undo
   Else
      If Me.NewRecord Then
         'Following code ensures that a license is created if one is not supplied
         '  User can update record with new license info when available.
         If IsNull(strTPT) Or strTPT = "" Then
            strTPT = "Unk" & Format(lngTPTID, "000000")
         End If
         TPTID = Me.lngTPTID
         Call AuditChanges(Me, "lngTPTID", "NEW")
      Else
         Call AuditChanges(Me, "lngTPTID", "EDIT")
      End If
   End If

BeforeUpdate_Exit:
   Exit Sub

BeforeUpdate_Error:
   MsgBox Err.Description
   ' Call LogError(Err.Number, Err.Description, "Form_BeforeUpdate()", "Form_frmTaxPayerDialog")
   If Not LogError(Err.Number, Err.Description, "Form_BeforeUpdate()", "Form_frmTaxPayerDialog") Then
      Me.Undo
   End If
   Resume BeforeUpdate_Exit

End Sub
=================================================
My next approach is to visit client, with a copy of the software having some additional code to try and track the  issue.  I.E. the taxpayer form and all subforms with addition text included with the message.
At this point, the system works fine on my computer system (both frontend and backend files contained in same directory).  Hopefully using the clients computer using the network structure will show some additional information.
I will post the outcome following the meeting with the client.
Rod

---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Rod-

Is this a message created by your application code, or is it one generated by the system?  Somehow your form is getting "dirtied" when you try to apply a filter.  What's the code behind one of the filter buttons?

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Mar 26, 2014, at 3:38 AM, desertscroller@... wrote:

Hi All, Not sure I can explain what is happening but here goes.  I have developed an application using Access 2010 that will run on Windows 8.1 and Windows 7.  The issue comes when the application is installed on a Windows 7 system.  The application is split.  Front-end on the user's machine and the back-end is located on a network server.  The users can log into the application will no issues and activate the main dialog.  On the main form are several command buttons of which 3 buttons activate the Taxpayer screen.  Each button applies a different filter.  When the Taxpayer screen is loading a message appears asking the user if he want to update the record.  This same message appears when the screen is closed.  In both cases nothing has changed. My idea is that the network connection is causing the issue.  Reason for this assumption is when the application is executed total from a single machine no issues occur.  Am I missing something or are there an suggestions for further investigation.  I will be going back to the user's site on Thursday and try the assumption on one of the user's system.  Any other suggestions to try would be greatly appreciated.
Rod


__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)
.

__,_._,___

Tidak ada komentar:

Posting Komentar