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 / General 2 / February 2007

Tip: Looking for answers? Try searching our database.

Not in list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
myxmaster@hotmail.com - 27 Feb 2007 13:13 GMT
Hello,
I am using the following code in a combobox named authorizers. When I
enter a new name I get a message telling me an error occured. Any help
is most appreciated.

This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Sub Authorizer_NotInList(NewData As String, Response As
Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String

   strMsg = "'" & NewData & "' is not a authorized Name " & vbCrLf &
vbCrLf
   strMsg = strMsg & "Do you want to add the new Name to the current
List?"
   strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to link or No to re-
type it."

   If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo
Then
       Response = acDataErrContinue
   Else
       Set db = CurrentDb
       Set rs = db.OpenRecordset("Authorizer", dbOpenDynaset)
       On Error Resume Next
       rs.AddNew
           rs!AEName = NewData
       rs.Update

       If Err Then
           MsgBox "An error occurred. Please try again."
           Response = acDataErrContinue
       Else
           Response = acDataErrAdded
       End If

   End If

rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Wayne-I-M - 27 Feb 2007 13:28 GMT
authorizers  should be Authorizer

Signature

Wayne
Manchester, England.

> Hello,
> I am using the following code in a combobox named authorizers. When I
[quoted text clipped - 47 lines]
> Set db = Nothing
> End Sub
myxmaster@hotmail.com - 27 Feb 2007 13:45 GMT
Hi Wayne,
I made the change however it still won't work. The table tame is
Authorizers and the field name is Authorizer.

> authorizers  should be Authorizer
>
[quoted text clipped - 53 lines]
> > Set db = Nothing
> > End Sub
myxmaster@hotmail.com - 27 Feb 2007 13:48 GMT
Hi Wayne,
I made the change however it still won't work. The table tame is
Authorizers and the field name is Authorizer.

> authorizers  should be Authorizer
>
[quoted text clipped - 53 lines]
> > Set db = Nothing
> > End Sub
Wayne-I-M - 27 Feb 2007 14:33 GMT
No worries - try this

Private Sub Authorizer _NotInList(NewData As String, Response As Integer)
  Dim Db As DAO.Database
  Dim rs As DAO.Recordset
  Dim Msg As String
      Msg = "'" & NewData & "' is not a authorized Name ." & vbCr & vbCr
      Msg = Msg & "Do you want to add a new name to the current list?"
      If MsgBox(Msg, vbQuestion + vbYesNo) = vbNo Then
          Response = acDataErrContinue
         MsgBox "Try again."
      Else
          Set Db = CurrentDb
          Set rs = Db.OpenRecordset("Authorizers ", dbOpenDynaset)
          rs.AddNew
          rs![ AEName] = NewData
          rs.Update
          Response = acDataErrAdded
      End If
End Sub

Notes
The table name being search/added to is called Authorizers
The combobox name is named Authorizer
The field being searched by combo Authorizer is AEName

Hope this helps - going out now for lunch - I need it

Signature

Wayne
Manchester, England.

> Hi Wayne,
> I made the change however it still won't work. The table tame is
[quoted text clipped - 57 lines]
> > > Set db = Nothing
> > > End Sub
myxmaster@hotmail.com - 28 Feb 2007 01:08 GMT
On Feb 27, 6:33 am, Wayne-I-M <Wayn...@discussions.microsoft.com>
wrote:
> No worries - try this
>
[quoted text clipped - 94 lines]
>
> - Show quoted text -

Hi Wayne,
The routine staps at
rs!AEName = NewData
Any ideas
TIA
storrboy - 28 Feb 2007 02:26 GMT
> Hi Wayne,
> The routine staps at
> rs!AEName = NewData
> Any ideas
> TIA

If I may interject...

Change the line
  MsgBox "An error occurred. Please try again."

To
  MsgBox "An error occurred. Please try again.", vbOkOnly, "Error# "
& Err.Number

and try running it again. This will indicate the actual error
encountered and help others to diagnose.
myxmaster@hotmail.com - 28 Feb 2007 07:37 GMT
After pasting your code into the original code the error message is
Error # 3265

> > Hi Wayne,
> > The routine staps at
[quoted text clipped - 13 lines]
> and try running it again. This will indicate the actual error
> encountered and help others to diagnose.
Douglas J. Steele - 28 Feb 2007 12:07 GMT
Error 3265 is "Item not found in this collection." The implication to me is
that AEName doesn't exist in the recordset: that it's called something else.

Signature

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

> After pasting your code into the original code the error message is
> Error # 3265
[quoted text clipped - 16 lines]
>> and try running it again. This will indicate the actual error
>> encountered and help others to diagnose.
 
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.