D
Debbi
Hi,
I'm having a problem that has been driving me crazy for days. I've checked
other's postings and have tried many of the suggestions to no avail.
I'm using Access 2000. In one database, I am using a form called EnterNewOrds.
It has an unbound combo box that does a record look up in the update event.
Then if not inlist it asks if you want to add it. Yes opens another form
called AddNewProp. No, resets the combo to reenter the loannum. My problem is
that when I open the new form setting newArgs to newData, I get an error
"Run-time error '-2147352567 (80020009)': You can't assign a value to this
object."
Any and all comments would be welcomed and greatly appreciated!
The code follows (forgive me if I give more than needed
):
'on the EnterNewOrds form
Private Sub cboLoanNum_AfterUpdate()
Dim MyLoanNum As DAO.Recordset
If Not IsNull(Me.cboLoanNum) Then
Set MyLoanNum = Me.RecordsetClone
MyLoanNum.FindFirst "[IntPropNum]= " & Me.cboLoanNum
Me.Bookmark = MyLoanNum.Bookmark
Me.Child61.SetFocus
End If
Set MyLoanNum = Nothing
End Sub
---------------------------------------------------------------------------------------
Private Sub cboLoanNum_NotInList(newData As String, response As Integer)
Dim mbrResponse As vbMsgBoxResult
Dim strMsg As String
Dim strDocName As String
strMsg = "Loan number " & newData & " is not in the list." & _
vbCrLf & vbCrLf & "Would you like to add it?"
strDocName = "AddNewProp"
mbrResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Add new property?")
Select Case mbrResponse
Case vbYes
response = acDataErrContinue
DoCmd.OpenForm strDocName, , , , acFormAdd, acDialog, newData
response = acDataErrAdded
Case vbNo
response = acDataErrContinue
Me.cboLoanNum.Undo
Me.cboLoanNum.SetFocus
End Select
End Sub
--------------------------------------------------------------------------------------
Private Sub Form_Activate()
Me.cboLoanNum.Requery
Me.cboLoanNum.SetFocus
End Sub
================================================
'On the AddNewProp
Private Sub Close_Click()
If IsOpen("EnterNewOrds") = True Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
[Forms]![EnterNewOrds].Requery
[Forms]![EnterNewOrds]![cboLoanNum] = Me.LoanNum
[Forms]![EnterNewOrds]![cboLoanNum].SetFocus
End If
DoCmd.Close acForm, "AddNewProp"
End Sub
-----------------------------------------------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
If MsgBox("Do you Want To Save the Current Record before Closing", _
vbQuestion + vbYesNo, "Current Record Has Not been Saved") =
vbNo Then
Me.Undo
End If
End If
End Sub
------------------------------------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
'<<------ The next line is where debug points to
Me.LoanNum = Me.OpenArgs
End If
End Sub
I'm having a problem that has been driving me crazy for days. I've checked
other's postings and have tried many of the suggestions to no avail.
I'm using Access 2000. In one database, I am using a form called EnterNewOrds.
It has an unbound combo box that does a record look up in the update event.
Then if not inlist it asks if you want to add it. Yes opens another form
called AddNewProp. No, resets the combo to reenter the loannum. My problem is
that when I open the new form setting newArgs to newData, I get an error
"Run-time error '-2147352567 (80020009)': You can't assign a value to this
object."
Any and all comments would be welcomed and greatly appreciated!
The code follows (forgive me if I give more than needed
'on the EnterNewOrds form
Private Sub cboLoanNum_AfterUpdate()
Dim MyLoanNum As DAO.Recordset
If Not IsNull(Me.cboLoanNum) Then
Set MyLoanNum = Me.RecordsetClone
MyLoanNum.FindFirst "[IntPropNum]= " & Me.cboLoanNum
Me.Bookmark = MyLoanNum.Bookmark
Me.Child61.SetFocus
End If
Set MyLoanNum = Nothing
End Sub
---------------------------------------------------------------------------------------
Private Sub cboLoanNum_NotInList(newData As String, response As Integer)
Dim mbrResponse As vbMsgBoxResult
Dim strMsg As String
Dim strDocName As String
strMsg = "Loan number " & newData & " is not in the list." & _
vbCrLf & vbCrLf & "Would you like to add it?"
strDocName = "AddNewProp"
mbrResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Add new property?")
Select Case mbrResponse
Case vbYes
response = acDataErrContinue
DoCmd.OpenForm strDocName, , , , acFormAdd, acDialog, newData
response = acDataErrAdded
Case vbNo
response = acDataErrContinue
Me.cboLoanNum.Undo
Me.cboLoanNum.SetFocus
End Select
End Sub
--------------------------------------------------------------------------------------
Private Sub Form_Activate()
Me.cboLoanNum.Requery
Me.cboLoanNum.SetFocus
End Sub
================================================
'On the AddNewProp
Private Sub Close_Click()
If IsOpen("EnterNewOrds") = True Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
[Forms]![EnterNewOrds].Requery
[Forms]![EnterNewOrds]![cboLoanNum] = Me.LoanNum
[Forms]![EnterNewOrds]![cboLoanNum].SetFocus
End If
DoCmd.Close acForm, "AddNewProp"
End Sub
-----------------------------------------------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
If MsgBox("Do you Want To Save the Current Record before Closing", _
vbQuestion + vbYesNo, "Current Record Has Not been Saved") =
vbNo Then
Me.Undo
End If
End If
End Sub
------------------------------------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
'<<------ The next line is where debug points to
Me.LoanNum = Me.OpenArgs
End If
End Sub