Solved

Error with After Update event procedure in Access Application

Posted on 2009-07-08
11
308 Views
Last Modified: 2013-11-28
Hi I have a form in Ms Access with Dropdownlists . If i select a value from one list the other dropdown should populate the value corresponding to that. but whenever i select the first dropdown iam getting the error message  "the expression AfterUpdate event property produce the following error ...blah ....blah ......" . I attached the image of that error with this. Please take a look and help me in this. i have been struggling with this error and the business user is pushing me to fix this quickly.  
Private Sub cboUser_AfterUpdate()
Set lstExistLoaded.Recordset = Nothing
lstExistLoaded.Requery
Set lstReport.Recordset = Nothing
lstReport.Requery
DBPix204.ImageViewFile ("")
cboSample_ID = Null
Set cboSample_ID.Recordset = Nothing
txtSampleID = Null
 
 
    If Not IsNull(cboUser) Then
       txtRequestNumber = cboUser
       DBPix204.ImageViewFile ("")
        SQLstatement = "SELECT ImageFileName,(rtrim(ImagePath))+(rtrim(ImageFileName)),ImagePath FROM ASC_vw_GetImages " & _
        " WHERE RequestNumber=" & cboUser & " AND ImageFileName IS NOT NULL ORDER BY ImageFileName "
        Set rst = New ADODB.Recordset
            rst.Open SQLstatement, CurrentProject.Connection, adOpenStatic
        With rst
            If Not (.EOF And .BOF) Then
               Set lstExistLoaded.Recordset = rst
            Else
                Set lstExistLoaded.Recordset = Nothing
            End If
        .Close
        End With
        Set rst = Nothing
        
        SQLstatement = "SELECT AttachFileName,AttachPathandName FROM AttachT " & _
        " WHERE RequestNumber=" & cboUser & " ORDER BY AttachID"
        Set rst = New ADODB.Recordset
            rst.Open SQLstatement, CurrentProject.Connection, adOpenStatic
        With rst
            If Not (.EOF And .BOF) Then
               Set lstReport.Recordset = rst
            Else
                Set lstReport.Recordset = Nothing
            End If
        .Close
        End With
        Set rst = Nothing
        
         SQLstatement = "SELECT Sample_ID,SampleID,Sample_Name FROM  SampleT " & _
        " WHERE RequestNumber=" & cboUser.Column(1) & " ORDER BY SampleID"
        Set rst = New ADODB.Recordset
            rst.Open SQLstatement, CurrentProject.Connection, adOpenStatic
        With rst
            If Not (.EOF And .BOF) Then
               Set cboSample_ID.Recordset = rst
            Else
                Set cboSample_ID.Recordset = Nothing
            End If
        .Close
        End With
        Set rst = Nothing
        formdirty = True
    End If
End Sub
 
 
 
I attached the image for the properties of that control.

Open in new window

error.JPG
Properties.jpg
0
Comment
Question by:gladstonesheeba
  • 6
  • 5
11 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24804836
which line is highlighted ?

0
 

Author Comment

by:gladstonesheeba
ID: 24805101
its not highlighting anything , the  After_update event is not firing . Whenever i choose a value from the dropdown, immediately iam getting that  error message . its not going to the cboUser_AfterUpdate().
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24805142
can you post the Row source of the combo box.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:gladstonesheeba
ID: 24805235
SELECT DISTINCT RequestNumber, RequestNoID FROM RequestT ORDER BY RequestNumber DESC
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24805317
can you comment all the lines like the one below and try again if you will see the message.
Private Sub cboUser_AfterUpdate()
MsgBox "cboUser_AfterUpdate"
'Set lstExistLoaded.Recordset = Nothing
'lstExistLoaded.Requery
'Set lstReport.Recordset = Nothing
'lstReport.Requery
'DBPix204.ImageViewFile ("")
'cboSample_ID = Null
'Set cboSample_ID.Recordset = Nothing
'txtSampleID = Null
'
'
'    If Not IsNull(cboUser) Then
'       txtRequestNumber = cboUser
'       DBPix204.ImageViewFile ("")
'        SQLstatement = "SELECT ImageFileName,(rtrim(ImagePath))+(rtrim(ImageFileName)),ImagePath FROM ASC_vw_GetImages " & _
'        " WHERE RequestNumber=" & cboUser & " AND ImageFileName IS NOT NULL ORDER BY ImageFileName "
'        Set rst = New ADODB.Recordset
'            rst.Open SQLstatement, CurrentProject.Connection, adOpenStatic
'        With rst
'            If Not (.EOF And .BOF) Then
'               Set lstExistLoaded.Recordset = rst
'            Else
'                Set lstExistLoaded.Recordset = Nothing
'            End If
'        .Close
'        End With
'        Set rst = Nothing
'
'        SQLstatement = "SELECT AttachFileName,AttachPathandName FROM AttachT " & _
'        " WHERE RequestNumber=" & cboUser & " ORDER BY AttachID"
'        Set rst = New ADODB.Recordset
'            rst.Open SQLstatement, CurrentProject.Connection, adOpenStatic
'        With rst
'            If Not (.EOF And .BOF) Then
'               Set lstReport.Recordset = rst
'            Else
'                Set lstReport.Recordset = Nothing
'            End If
'        .Close
'        End With
'        Set rst = Nothing
'
'         SQLstatement = "SELECT Sample_ID,SampleID,Sample_Name FROM  SampleT " & _
'        " WHERE RequestNumber=" & cboUser.Column(1) & " ORDER BY SampleID"
'        Set rst = New ADODB.Recordset
'            rst.Open SQLstatement, CurrentProject.Connection, adOpenStatic
'        With rst
'            If Not (.EOF And .BOF) Then
'               Set cboSample_ID.Recordset = rst
'            Else
'                Set cboSample_ID.Recordset = Nothing
'            End If
'        .Close
'        End With
'        Set rst = Nothing
'        formdirty = True
'    End If
End Sub

Open in new window

0
 

Author Comment

by:gladstonesheeba
ID: 24805705
Yes iam getting that message box cboUser_AfterUpdate.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24805769
where are you executing the codes? in VB not in Access?

lets find the erring line by removing the ' from the codes starting from the top.

unremark this

Set lstExistLoaded.Recordset = Nothing
lstExistLoaded.Requery
Set lstReport.Recordset = Nothing
lstReport.Requery
DBPix204.ImageViewFile ("")
cboSample_ID = Null
Set cboSample_ID.Recordset = Nothing
txtSampleID = Null


then try again by selecting a value from the combo box

0
 

Author Comment

by:gladstonesheeba
ID: 24805832
ok i  uncommented out those lines,  i got the message box .
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24805923
no error?

0
 

Author Comment

by:gladstonesheeba
ID: 24805985
I think something with the DBPix204.ImageViewFile("")

If i uncomment that line  and assign the dropdown value to  show it in the textbox. Then its not working . If  i comment the DBpix204.ImageViewFile(""), then the dropdown value is showing in the textbox. But i am not sure why the dbpix is not working. I referenced the Active x control for that in the project, but why still its not recognizing.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 24806296
see if you find an answer here about DBpix

http://www.ammara.com/support/index.html

0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question