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 / Conversion / March 2004

Tip: Looking for answers? Try searching our database.

help with code conversion

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brigitte P - 22 Mar 2004 02:14 GMT
I have this code that worked fine in A97. The code is initiated with a
macro, then runs and toggles the Bypasse key. When I converted to A2002 it
will work only in unsecured databases. When I have to import my objects to
fully secure the dbase, the code won't run, stops at the second line at the
DAO: Here is the code:

Option Compare Database
Option Explicit

Sub ToggleAllowBypassKey()
Dim dbs As DAO.Database, prp As DAO.Property
Set dbs = CurrentDb
Const conPropNotFoundError = 3270
On Error GoTo Change_Err

   If dbs.Properties("AllowBypassKey") = True Then
       dbs.Properties("AllowBypassKey") = False
       MsgBox "Shift Key Bypass is now disabled."
   Else
       dbs.Properties("AllowBypassKey") = True
       MsgBox "Warning! Shift Key Bypass has been enabled."
   End If
Change_Err:
   If Err = conPropNotFoundError Then  ' Property not found.
       Set prp = dbs.CreateProperty("AllowBypassKey", dbBoolean, True)
       dbs.Properties.Append prp
   End If
Resume Next
End Sub
' Code my Mark Miller, Microsoft Support
Joan Wild - 22 Mar 2004 15:53 GMT
Access 2002 has a reference set to ADO by default, and not one set to DAO.

Since it is unlikely that you use ADO, open any code module, and go to
Tools, References.

Uncheck the reference to ADO, and put a check beside
Microsoft DAO 3.6 Object Library

Then Debug, Compile and then click on the save button.

Signature

Joan Wild
Microsoft Access MVP

> I have this code that worked fine in A97. The code is initiated with a
> macro, then runs and toggles the Bypasse key. When I converted to A2002 it
[quoted text clipped - 26 lines]
> End Sub
> ' Code my Mark Miller, Microsoft Support
Brigitte P - 23 Mar 2004 01:04 GMT
Hi Joan,
I need to work a little with this because the DAO was checked. But here is
another snipped of code that has trouble.
Option Compare Database
Option Explicit

Private Sub Detail_Click()
   Dim MySSN As Control
   Dim ctlList As Variant

   SetctlList = Me!SSN
   ctlList.Requery
End Sub

It balks at the "SetctlList" line. This is not something that I wrote, but
something inserted interactively by I forgot what. The database is a few
years old, and I don't know every bit of code in there. I'm not that good
and depend a lot on the usergroups.
Again, many thanks -- wish you worked in our place :)
Brigitte
> Access 2002 has a reference set to ADO by default, and not one set to DAO.
>
[quoted text clipped - 37 lines]
> > End Sub
> > ' Code my Mark Miller, Microsoft Support
Brigitte P - 23 Mar 2004 03:13 GMT
Joan: I keep on running into problems with code. Most of my code comes from
the user groups and worked great in my A97, but I don't understand the
syntax, thus I can't repair things. Here is another piece that won't work:
Option Compare Database
Option Explicit

Private Sub Form_GotFocus()
DoCmd.GoToRecord , , acNewRec
End Sub

Private Sub txtTypeContribution_NotInList(NewData As String, Response As
Integer)
Dim db As Database, rs As Recordset
   Dim strMsg As String
   strMsg = "'" & NewData & "' is not an available option. "
   strMsg = strMsg & "Do you want to add the new donation type? "
   strMsg = strMsg & "Click YES to add the new donation type or NO to
select an existing one it."
   If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new type?") = vbNo Then
       Response = acDataErrContinue
   Else
       Set db = CurrentDb
       Set rs = db.OpenRecordset("tblTypeContributionLookup",
dbOpenDynaset)
       On Error Resume Next
       rs.AddNew
           rs!TypeContr = NewData
       rs.Update

       If Err Then
           MsgBox "An error occurred. Please try again."
           Response = acDataErrContinue
       Else
           Response = acDataErrAdded
       End If
   End If
End Sub
Runs into Error 13 at Set rs = db.OpenRecordset("tblTypeContributionLookup",
dbOpenDynaset)

I checked the Microsoft DAO 3.6 Object Library, helps with the original code
I had problems with (toggle Bypass Key), but not this one. I checked in the
original A97 dbase wich has Microsoft DAO 3.51 Object Library. I changed
from 3.6 to 3.51, still the above doesn't work.  I developed and managed
several fairly sophisticated databases in A97 with a lot of help from texts
and user groups, but now I'm stumped if all that code doesn't work any
longer. Any ideas what a non-programmer like me can do?
Thanks
Brigitte

> Access 2002 has a reference set to ADO by default, and not one set to DAO.
>
[quoted text clipped - 37 lines]
> > End Sub
> > ' Code my Mark Miller, Microsoft Support
Joan Wild - 23 Mar 2004 15:22 GMT
Hi Brigitte,

You have a 2002 version mdb, correct?

In Tools, references you should have these checked
DAO 3.6
Visual Basic For Applications
Access 10.0

You should then go to the Debug window and choose Compile
Then click on Save and close the module.

I would then compact the database.

I don't see anything wrong with the code.  What does 'doesn't work' mean?
Do you get an error?

Signature

Joan Wild
Microsoft Access MVP

> Joan: I keep on running into problems with code. Most of my code comes from
> the user groups and worked great in my A97, but I don't understand the
[quoted text clipped - 89 lines]
> > > End Sub
> > > ' Code my Mark Miller, Microsoft Support
Brigitte P - 29 Mar 2004 01:43 GMT
Thanks Joan. I think I got it for the time being with DOA 3.6. I also
ordered an A2002 manual so I have a reference.
Thanks again.
Brigitte
> Hi Brigitte,
>
[quoted text clipped - 116 lines]
> > > > End Sub
> > > > ' Code my Mark Miller, Microsoft Support
 
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.