Minggu, 26 Mei 2013

RE: [MS_AccessPros] Help - NotInList.

 

Hello John,

Thank you for your quick answer, however I got Run-time error '-2147352567
(80020009)': You can't assign a value to this object.

It highlighted this line "Me.Policy = Me.OpenArgs" I hovered my mouse over
the code and the Me.Policy=Nulls, but the Me.OpenArgs is picking up the
value I entered.

Did I missed something?

Thanks..

zjubias

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John Viescas
Sent: Sunday, May 26, 2013 11:58 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] Help - NotInList.

ZJubias-

The value of the combo box won't get passed automatically to the form - you
have to do something to either pass it or pick it up from the called form.
I suggest you change this:

DoCmd.OpenForm "frmPolicy", , , , acFormAdd, acDialog

To:

DoCmd.OpenForm "frmPolicy", OpenArgs:=NewData, _
DataMode:=acFormAdd, WindowMode:=acDialog

Then in the Open event of frmPolicy do:

Private Sub Form_Open(Cancel As Integer)
' If passed a value,
If Len(Me.OpenArgs) > 0 Then
' Set the value in Policy
Me.Policy = Me.OpenArgs
End If
End Sub

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
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of ZJUbias
Sent: Sunday, May 26, 2013 12:37 PM
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
Subject: [MS_AccessPros] Help - NotInList.

Hello All,

Am using the below code for my NotInList combo control of my dataentry. It
did fired up the NotInList and pop me the message and if answered Yes, it
opens up the form to continue filling up the rest controls.

But the problem is, it ask me again to enter the PolicyNumber which is
already entered in my combo box, it should carry/save to the opened form as
I already entered before the NotInList fired up

Can someone please examine the code and tell me the missing part..

Thank you in advance,

Zjubias..

-------------------

Private Sub CboPolicy_NotInList(NewData As String, Response As Integer)

On Error GoTo Err_ CboPolicy _NotInList

Dim strMsg As String, strTitle As String

strMsg = NewData & " is not in list. Would you like to add it?"
strTitle = " Add New Entry ?"
If MsgBox(strMsg, vbQuestion + vbYesNo, strTitle) = vbYes Then
DoCmd.OpenForm "frmPolicy", , , , acFormAdd, acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

Exit_ CboPolicy _NotInList:
Exit Sub

Err_ CboPolicy _NotInList:
MsgBox Err.Number & ":" & Err.Description
Resume Exit_ CboPolicy _NotInList

End Sub

-----------------

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

[Non-text portions of this message have been removed]

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

__,_._,___

Tidak ada komentar:

Posting Komentar