David McAfee
davidmcafee at gmail.com
Fri Apr 1 13:37:04 CDT 2011
I've been struggling with this issue for the last couple of days and it is
driving me nuts.
The user didn't have problems until they were given a newer computer.
The computer has Vista as the OS and Access2007.
I have some forms that were originally created in Access 2000, and another
created in (I believe Access 2003).
Now that they have the new computer, when the user clicks on cmdLocationAdd
(or Edit), Access seems to lock up.
What I believe is happening is that the form 002D is opening up in modal
mode, but not on top of the form that is calling it.
I can't recreate it on my machine (also a Vista box with A2007).
I checked our references and they both match:
Visual Basic for Applications
Microsoft Access 12.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Microsoft DAO 3.6 Object Library
Any ideas?
Here are the related subs:
The A2003 calls a form on an OnClick event:
Private Sub cmdLocationAdd_Click()
Dim strOpenArgs As String
strOpenArgs = "1|" & Me.lstCompaniesFound.Column(0) & "|||" &
Me.lstCompaniesFound.Column(1)
'Debug.Print strOpenArgs
DoCmd.OpenForm "frm_002D_Company", , , , , acDialog, strOpenArgs
'frm_002D_Company's opening Args are: Mode | CompanyID or AddrID | Return
Form | Return Field | CompanyName
End Sub
Private Sub cmdLocationEdit_Click()
Dim strOpenArgs As String
'frm_002D_Company's opening Args are: Mode | AddrID | null | null | null |
strOpenArgs = "2|" & Me.lstCompanyLocations.Column(1) & "|||" &
Me.lstCompaniesFound.Column(1) '2 = Edit
DoCmd.OpenForm "frm_002D_Company", , , , , acDialog, strOpenArgs
Me.lstCompanyLocations.Requery
End Sub
Private Sub Form_Load()
On Error GoTo Form_Load_Error
'Dim errNum As Double, errDesc As String, errLine As Integer
If Not IsNull(Me.OpenArgs) Then
Dim arrX As Variant
arrX = Split(Me.OpenArgs, "|")
intMode = arrX(0)
Select Case intMode
Case 1 'Add Mode
Me.txtCompanyID = arrX(1)
Me.txtCompanyName = Nz(arrX(4), "")
Me.cmdOK.Caption = "Confirm Addition"
Me.Caption = "New Address Entry"
'Hide listbox & cmd button as we don't have an AddressID yet
Me.lstAddtionalInfo.Visible = False
Me.cmdAddAddtionalInfo.Visible = False
Me.cmdEditAddtionalInfo.Visible = False
Me.cmdDelAddtionalInfo.Visible = False
' Show fields below, so we can write to the appropriate fields
when we append this record
Me.txtPhone.Visible = True
Me.txtfax.Visible = True
Me.txtemail.Visible = True
Me.txtLocationName = Nz(Me.txtLocationName, "Main Office")
Case 2 'Edit Mode
Me.txtAddrID = arrX(1)
Me.txtCompanyName = Nz(arrX(4), "")
Me.cmdOK.Caption = "Confirm Edit"
Me.Caption = "Company Address Edit"
'Show listbox & cmd button as we now have an AddressID
Me.lstAddtionalInfo.Visible = True
Me.cmdAddAddtionalInfo.Visible = True
Me.cmdEditAddtionalInfo.Visible = True
Me.cmdDelAddtionalInfo.Visible = True
'No need to show these fields as we have the listbox available
Me.txtPhone.Visible = False
Me.txtfax.Visible = False
Me.txtemail.Visible = False
FillAddress (Me.txtAddrID)
'Fill Phone/fax/email info:
Me.lstAddtionalInfo.RowSource = "EXEC stp_002DFillCompanyInfo "
& Me.txtAddrID
Case Else
'Trap code removed
End Select
strReturnForm = arrX(2) 'Parameter 3, the form that we will return the
data to
strReturnField = arrX(3) 'Parameter 4, the field in the above form that
data will return to
Else
'Do stuff when opened without OpenArgs
End If
End Sub