Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

Error with After Update event procedure in Access Application

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
gladstonesheeba
Asked:
gladstonesheeba
  • 6
  • 5
1 Solution
 
Rey Obrero (Capricorn1)Commented:
which line is highlighted ?

0
 
gladstonesheebaAuthor Commented:
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
 
Rey Obrero (Capricorn1)Commented:
can you post the Row source of the combo box.
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
gladstonesheebaAuthor Commented:
SELECT DISTINCT RequestNumber, RequestNoID FROM RequestT ORDER BY RequestNumber DESC
0
 
Rey Obrero (Capricorn1)Commented:
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
 
gladstonesheebaAuthor Commented:
Yes iam getting that message box cboUser_AfterUpdate.
0
 
Rey Obrero (Capricorn1)Commented:
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
 
gladstonesheebaAuthor Commented:
ok i  uncommented out those lines,  i got the message box .
0
 
Rey Obrero (Capricorn1)Commented:
no error?

0
 
gladstonesheebaAuthor Commented:
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
 
Rey Obrero (Capricorn1)Commented:
see if you find an answer here about DBpix

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

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now