UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Run-time Error 438, Access 2010    
 
   
AllenCherry
post Mar 20 2020, 03:44 PM
Post#1



Posts: 9
Joined: 19-July 10



Anyone who can help please,

I am trying to construct a search on a database using the following code:

###########################################################

Private Sub Part_Number_AfterUpdate()

Dim Search_String As Variant

Search_String = Forms!Search.Part_Number
Forms!Aircraft!Quarantine_Stock_Subform.Form.Filter = "Supplier_Part_No Like '" & Search_String & "'" And Forms!Aircraft!Quarantine_Stock_Subform.Stock_Quantity = 0
Forms!Aircraft!Quarantine_Stock_Subform.Form.FilterOn = True
DoCmd.Close acForm, "Search"

End Sub

##################################################################

It works if I use the following line:

Forms!Aircraft!Quarantine_Stock_Subform.Form.Filter = "Supplier_Part_No Like '" & Search_String & "'"

omitting the requirement to filter the displayed records to show only those with 'Stock_Quantity = 0'

When I add the additional filter 'And Forms!Aircraft!Quarantine_Stock_Subform.Stock_Quantity = 0' I get Run-Time error 438.

Any help will be very gratefully received!

Many thanks,

Allen
Go to the top of the page
 
Jackal
post Mar 20 2020, 03:51 PM
Post#2



Posts: 9
Joined: 18-October 18



try:

Forms!Aircraft!Quarantine_Stock_Subform.Form.Filter = "Supplier_Part_No Like '" & Search_String & "'" & "And Stock_Quantity = 0"
Go to the top of the page
 
MadPiet
post Mar 20 2020, 03:59 PM
Post#3



Posts: 3,792
Joined: 27-February 09



Or maybe

Forms!Aircraft!Quarantine_Stock_Subform.Form.Filter = "Supplier_Part_No Like '*" & Search_String & "*'" & "And Stock_Quantity = 0"
Go to the top of the page
 
AllenCherry
post Mar 20 2020, 10:15 PM
Post#4



Posts: 9
Joined: 19-July 10



My sincere thanks to you!

Works perfectly!

Thank you for your help,

Allen
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    11th July 2020 - 05:44 AM