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 / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

On Not In List/After Update Events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rdw1260@msn.com.(donotspam) - 16 Jul 2007 15:58 GMT
I have the follwing code for OnNotInList and AfterUpdate Events:

Private Sub Steward_s_Name_NotInList(NewData As String, Response As Integer)
If MsgBox("The Union Representative's name you entered was not found, do you
want to add the name you entered?", _
vbYesNo + vbQuestion, _
"Please Respond") = vbYes Then
DoCmd.OpenForm "UnionRepsList", _
Datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
If IsLoaded("UnionRepsList") Then
Response = acDataErrAdded
DoCmd.Close acForm, "UnionRepsList"
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub
================================================
Private Sub Steward_s_Name_AfterUpdate()
Me.Requery
Me.Refresh
End Sub
================================================
My problem is that after entering the new name in the form UnionRepsList,
the new name does not appear in the combo box named Steward's_Name. As a
consequence I cannot select the new name and I get the same error message
that the name is not in the list. After selecting a differnt name in the
combo box and after entering the next control, I can go back to the combo box
and see the newly entered name.

What is problem with my code?

Thanks for the help.
Signature

Bob

Douglas J. Steele - 16 Jul 2007 16:15 GMT
You're opening the UnionRepsList form in dialog mode, which means that the
code will stop executing until the form has been closed.

That means your check

If IsLoaded("UnionRepsList") Then
 Response = acDataErrAdded
 DoCmd.Close acForm, "UnionRepsList"
Else
 Response = acDataErrContinue
End If

isn't correct. Try replacing that entire chunk of code with

Response = acDataErrAdded

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have the follwing code for OnNotInList and AfterUpdate Events:
>
[quoted text clipped - 36 lines]
>
> Thanks for the help.
rdw1260@msn.com.(donotspam) - 17 Jul 2007 15:30 GMT
Doug:

It worked. I got the code I used from an Access 2000 book and modified it
for my use. I checked it again to make use I entered it correctly. Why
wouldn't the code you suggested be replaced not work for Access 2003? It
included the code:  Response = acDataErrAdded.

Thanks again for the help.
Signature

Bob

> You're opening the UnionRepsList form in dialog mode, which means that the
> code will stop executing until the form has been closed.
[quoted text clipped - 52 lines]
> >
> > Thanks for the help.
Douglas J. Steele - 17 Jul 2007 15:54 GMT
What you had would have had the same issue in Access 2000. Authors of books
do occasionally make mistakes!

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Doug:
>
[quoted text clipped - 68 lines]
>> >
>> > Thanks for the help.
 
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.