Results 1 to 10 of 10
  1. #1
    ellisbill
    Guest

    Can't write code

    Folks,

    Every attempt to write code in a newly created db in Access 2000 leads to an error with message "Can't find project or library". Subsequent checking of the References List has nothing marked "Missing". I use several heavily coded db's that have been updated from Access 97 without incident.

    Any help out there?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Can't write code

    Access 2000 defaults to ADO as its object model for new databases. Access 97 defaulted to DAO, and upgraded databases carry that reference with them.

    If you are accustomed to writing DAO, you're going to have to set the DAO reference and either take out the ADO reference or go back and update your declarations to specify the DAO library. For example, dim dbs as DAO.Database rather than just as Database. I usually replace the expression as Database with as DAO.Database and then go on to do it for other objects like TableDefs, QueryDefs, Recordsets, Properties, Fields and Indexes. Some of these also exist in ADO so you save yourself and the application a lot of confusion by declaring everything specifically.
    Charlotte

  3. #3
    ellisbill
    Guest

    Re: Can't write code

    Charlotte,

    Thanks for the response but I must admit I haven't a clue what you're talking about.

    Let me try this again. I haven't written a line of code for this database yet, because I can't. I get the referenced error by just using the Command Button Wizard in form design. I mentioned the operation of the converted Access 97 db's just as a fact for reference. The converted code all works perfectly but Access 2000 can't generate new code with it's own wizard. I'm not trying to convert anything. I was trying to create the db in 2000.

    Does that clarify my problem or just make it hazier?

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Can't write code

    Hi,
    Does this only happen if you try and use a wizard or even if you create a new module and type code manually?
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Can't write code

    Ah, you didn't mention the wizard so I thought you were talking about compile errors in the code. The wizard is a different problem. Does this happen when you first try to use the wizard or as you work through the prompts? If the latter, it sounds like your installation left out or improperly installed the wizard. Do you have the same problem with wizards in any of the other Office apps?
    Charlotte

  6. #6
    ellisbill
    Guest

    Re: Can't write code

    Charlotte and Rory,
    Based on your replies, I placed a command button on a form, canceled the wizard, selected the Click event, Code builder and inserted the following code:

    Private Sub cmdOpenEmployees_Click()
    On Error GoTo Err_cmdOpenEmployees_Click

    Dim DocName As String, LinkCriteria As String

    DocName = "frmEmployees"
    DoCmd.OpenForm DocName, , , LinkCriteria

    Exit_cmdOpenEmployees_Click:
    Exit Sub

    Err_cmdOpenEmployees_Click:
    MsgBox Error$
    Resume Exit_cmdOpenEmployees_Click

    End Sub

    This is, of course, a copy of code used by me over and over in 97 db's. The resultant code compilies without incident but will not either single step or run continuos from the Visual Basic environment. Clicking on the Command button yields the following error message:
    "The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or Active X control.
    *The expression may not result in the name of a macro, the name of a user defined function, or [Event Procedure].
    *There may have been an error evaluating the function, event, or macro.

    I have now told you more than I know about where I am at.

  7. #7
    ellisbill
    Guest

    Re: Can't write code

    Charlotte and Rory,
    Based on your replies, I placed a command button on a form, canceled the wizard, selected the Click event, Code builder and inserted the following code:

    Private Sub cmdOpenEmployees_Click()
    On Error GoTo Err_cmdOpenEmployees_Click

    Dim DocName As String, LinkCriteria As String

    DocName = "frmEmployees"
    DoCmd.OpenForm DocName, , , LinkCriteria

    Exit_cmdOpenEmployees_Click:
    Exit Sub

    Err_cmdOpenEmployees_Click:
    MsgBox Error$
    Resume Exit_cmdOpenEmployees_Click

    End Sub

    This is, of course, a copy of code used by me over and over in 97 db's. The resultant code compiles without incident but will not either single step or run continuous from the Visual Basic environment. Clicking on the Command button yields the following error message:
    "The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or Active X control.
    *The expression may not result in the name of a macro, the name of a user defined function, or [Event Procedure].
    *There may have been an error evaluating the function, event, or macro.

    I have now told you more than I know about where I am at.

    Best regards,

    WJE

  8. #8
    ellisbill
    Guest

    Re: Can't write code

    Charlotte and Rory,
    Based on your replies, I placed a command button on a form, canceled the wizard, selected the Click event, Code builder and inserted the following code:

    Private Sub cmdOpenEmployees_Click()
    On Error GoTo Err_cmdOpenEmployees_Click

    Dim DocName As String, LinkCriteria As String

    DocName = "frmEmployees"
    DoCmd.OpenForm DocName, , , LinkCriteria

    Exit_cmdOpenEmployees_Click:
    Exit Sub

    Err_cmdOpenEmployees_Click:
    MsgBox Error$
    Resume Exit_cmdOpenEmployees_Click

    End Sub

    This is, of course, a copy of code used by me over and over in 97 db's. The resultant code compiles without incident but will not either single step or run continuous from the Visual Basic environment. Clicking on the Command button yields the following error message:
    "The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or Active X control.
    *The expression may not result in the name of a macro, the name of a user defined function, or [Event Procedure].
    *There may have been an error evaluating the function, event, or macro.

    I have now told you more than I know about where I am at.

    Best regards,

    WJE


    Best regards,

    WJE

  9. #9
    ellisbill
    Guest

    Re: Can't write code

    Charlotte,

    Pardon the slip, I forgot to answer your other question: I have never had any other problem with any Office Wizard. And this wizard goes all the way to the very last dialog before failure.

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Can't write code

    Ouch! OK, it's a last ditch effort, but try this. With Access open, go to Start-->Programs and open either Word or Excel. From the Help menu of the other app, select Detect and Repair. That will force a detect and repair on Access as well, and it may cure your odd problem. Of course, it may not, too; but at this point, it's worth a try.[img]/w3timages/icons/crazy.gif[/img]
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •