Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108

    A problem occurred while Microsoft Access...

    "The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with eh OLE server or ActiveX Control."

    I get this error EVERY time I do something in code view. I took all the stuff I put in there out, and the errors went away. Once i put something in there, even as simple as disabling a text box based on the value of a check box, that error comes up when you view the form and use the control in question.

    Right now I am trying to get a button to print a report for one record based on the record one is viewing on the form.

    However, this error is making things nearly impossible.

    Some things I think might contribute to this, but really shouldn't, are this:

    -Created in 2010 format, saved as 2002-2003 file format.
    -Saved as a new database (i.e. v1.0, v1.1, v2.0)



    Does anyone know what is going on or am I just screwed and need to start over?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would try *importing* everything into a fresh, new db and see if the problem follows. http://www.btabdevelopment.com/ts/impnew

  3. #3
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    THANK YOU SO MUCH!

    I do have an issue though, I want users who are putting data into a form, to be able to print a report, based on that single record they are viewing. I dont want them to have to go through the print menu, or have to go through and find the individual report... I want a series of buttons that say "print report x" "pring report y" "print report z"

    up untill this point i was unable to do so due to that stupid error message. i found some places online that have code snippets that are designed to do this sort of thing, and while i work on some of these things, is there anything you might know, as Access Experts, that I should look out for or avoid?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you already looked at this link? http://www.mvps.org/access/reports/rpt0002.htm

  5. #5
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    I did, and I found a couple other, but none seem to do what I need it to, or, in some cases, do not work at all...

    I have a menu in my form, but for now, I will stick with one thing at a time...

    I have a group of three buttons that should only print (not open, view, etc...) one report. There are three reports, hence 3 buttons one for each.

    Button 'Command676' reads Reservation Report. When clicked, it should read the same record being viewed on frmTour in rptReservationReport and print that one report.

    I tried the code in the example on that link you showed, and had no sucess...

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What do you mean by "no success"? Did it not limit the records of the report? Did it error out?

  7. #7
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    When I click a button, It will not print out. I checked the code over, and it seems to be okay...

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Can you post the code here so we can see it?

  9. #9
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    Absolutely!


    Private Sub Command676()
    On Error GoTo Err_Command676_Click
    Dim strDocName As String
    Dim strWhere As String
    strDocName = "rptMarty"
    strWhere = "[RunID]=" & Me!RunID
    DoCmd.OpenReport strDocName, acPreview, , strWhere

    End Sub

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If RunID is a string and not a numerical field then you will need quotes:
    strWhere = "[RunID]='" & Me!RunID & "'"
    If you remove the WhereCondition argument, does it then run the report but with everyone?

  11. #11
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    No...

    But maybe I am confused about the RunID... I thought that was somehting built in to VBA. Is RunID supposed to be in reference to something in a Table, Report, etc? Now that I look at it, I want to say that since the tables primary key is "pkTourID", would RunID supposed to be "pkTourID"?

    Here is the names of the stuff I am looking at...

    Everything is based off of tblTour.
    The form name is frmReservation
    The report that needs to be run is rptMarty

    Maybe its possible that I have to change some other names in the codeblock??

    If I have:

    Dim strDocName As String
    Dim strWhere As String
    strDocName = "rptSomeReport"
    strWhere = "[RunID]=" & me!RunID
    DoCmd.OpenReport strDocName, acPreview, , strWhere

    What should the end result look like?

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'll take a flyer and say:
    Dim strDocName As String
    Dim strWhere As String
    strDocName = "rptMarty"
    strWhere = "[pkTourID]=" & me!RunID
    DoCmd.OpenReport strDocName, acPreview, , strWhere

  13. #13
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    Private Sub Command676()
    On Error GoTo Err_Command676_Click

    Dim strDocName As String
    Dim strWhere As String
    strDocName = "rptMarty"
    strWhere = "[pkTourID]=" & Me!RunID
    DoCmd.OpenReport strDocName, acPreview, , strWhere


    End Sub





    When the button is clicked, still, nothing happens. I triple checked, and I am in the right section of code...

  14. #14
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    Private Sub Command691_Click()
    On Error GoTo Err_Command691_Click

    Dim stDocName As String

    stDocName = "rptArrivalForm"
    DoCmd.OpenReport stDocName, acNormal

    Exit_Command691_Click:
    Exit Sub

    Err_Command691_Click:
    MsgBox Err.Description
    Resume Exit_Command691_Click

    End Sub


    thats the default code that will print a report, but this prints ALL of the records on file, which, with 5000 entries, is obviously problematic...

  15. #15
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    Okay, the code in that example had "str" and it should be "st" instead in order to work. I created a new button using the print record operation and merged the code provided in the example provided into the code generated by the wizard. It will not load the form and print the corresponding report based on the record being viewed on the form, as desired. An example of the code is provided below:

    Private Sub btnPrintOfficerReport_Click()
    On Error GoTo Err_btnPrintOfficerReport_Click

    Dim stDocName As String
    Dim stWhere As String

    stDocName = "rptOfficer"
    stWhere = "[pkTourID]=" & Me!pkTourID
    DoCmd.OpenReport stDocName, acNormal, , stWhere

    Exit_btnPrintOfficerReport_Click:
    Exit Sub

    Err_btnPrintOfficerReport_Click:
    MsgBox Err.Description
    Resume Exit_btnPrintOfficerReport_Click

    End Sub

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. An Unhandled win32 exception occurred in MSAccess.exe
    By Alice Liu in forum Import/Export Data
    Replies: 2
    Last Post: 12-08-2010, 01:40 PM
  2. Replies: 0
    Last Post: 10-13-2010, 03:28 PM
  3. Replies: 1
    Last Post: 06-20-2010, 05:04 AM
  4. Microsoft Access over the Network
    By JimG in forum Access
    Replies: 1
    Last Post: 05-19-2010, 02:23 PM
  5. Microsoft access
    By rose rivera in forum Access
    Replies: 0
    Last Post: 08-28-2008, 05:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums