473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

run-time error 424 object required

Hi
I am new at this could someone point me in the right direction
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdSearch_Click()
  3.  
  4.     If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
  5.         MsgBox "You must select a field to search."
  6.  
  7.     ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
  8.         MsgBox "You must enter a search string."
  9.  
  10.     Else
  11.  
  12.  
  13.         GCriteria = cboSearchField.Value & " LIKE '*" & txtSearchString & "*'"
  14.  
  15.  
  16.         Form_frmDVDPrograms1.RecordSource = "select * from DVDPrograms where " & GCriteria
  17.         Form_frmDVDPrograms1.Caption = "DVDPrograms (" & cboSearchField.Value & " contains '*" & txtSearchString & "*')"
  18.  
  19.  
  20.         DoCmd.Close acForm, "frmSearch"
  21.  
  22.         MsgBox "Results have been filtered."
  23.  
  24.     End If
  25.  
  26. End Sub
  27.  
  28.  
Problem with the line
Expand|Select|Wrap|Line Numbers
  1.  Form_frmDVDPrograms1.RecordSource = "select * from DVDPrograms where " & GCriteria
  2.  
Nov 16 '08 #1
6 3936
smartchap
236 100+
Please check if table DVDPrograms or form Form_frmDVDPrograms exits. It appears that either of them is not found / set in the form.
Nov 17 '08 #2
lotus18
866 512MB
Double-check if the field is really existing or not. Uhm... Why don't you try to replace the asterisk character (*) with percent sign (%). This is only just a suggestion : ).

Rey Sean
Nov 17 '08 #3
Hi there.

The line below is not correct.

GCriteria = cboSearchField.Value & " LIKE '*" & txtSearchString & "*'"

When you use the LIKE and you desire to get similar words you need to supply the symbol % not *

Your line should be (pick just one) depending what you expect from your query.

Expand|Select|Wrap|Line Numbers
  1. GCriteria = cboSearchField.Value & " LIKE '%" & txtSearchString & "'"
  2.  
  3. or
  4.  
  5. GCriteria = cboSearchField.Value & " LIKE '" & txtSearchString & "%'"
  6.  
  7. or 
  8.  
  9. GCriteria = cboSearchField.Value & " LIKE '%" & txtSearchString & "%'"
  10.  
  11.  
  12.  
Nov 18 '08 #4
Thanks for your input but still failing at the same line of code and have tried all your suggestions

Tony
Nov 23 '08 #5
debasisdas
8,127 Expert 4TB
try using this

Expand|Select|Wrap|Line Numbers
  1. GCriteria = cboSearchField.list(cboSearchField.ListIndex) & " LIKE  '%" & txtSearchString & "%'"
  2.  
Nov 23 '08 #6
Stewart Ross
2,545 Expert Mod 2GB
You have not posted the value of GCriteria, which includes the item selected from your combo (your search field names). I would guess these field names have spaces in them. Spaces in the field name within the WHERE part will cause a run-time error unless you use the correct syntax for the DB engine concerned. You don't say what the DB is, so I'll assume it is Jet (Access) for now.

You will need to include the field name in brackets in your SQL string for the syntax to be correct.

GCriteria = "[" & cboSearchField & "] LIKE '*"

If indeed it is the Jet database engine you are accessing then the wildcard character for use with Like is the "*" and not the "%". On the other hand you might be accessing a different DB back-end in which the '%' is the wildcard - we don't know because you have not told us what DB you are using.

-Stewart
Nov 26 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: leroybt.rm | last post by:
Can someone tell me how to run a script from a interactive shell I type the following: >>>python filename >>>python filename.py >>>run filename >>>run filename.py >>>/run filename >>>/run...
4
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of...
15
by: mg | last post by:
How can I run an .exe using C# from within the code behind of a WebForm app?
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
9
by: shank | last post by:
What is the proper syntax to run this command line in ASP? wzzip.exe File.zip File.txt thanks
6
by: Joel | last post by:
2 Questions: (1) The documentation says application.run() creates a standard message loop on the current thread and "optionally" shows a form. This is really confusing because I was of the...
7
by: Lee Crabtree | last post by:
I remember when I was first getting into .NET Forms programming that there was a rather emphatic rule about not constructing a form before calling Application.Run with it. So this: ...
8
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? --...
26
by: Chief | last post by:
Hello i would like to know which syntax do i have to use in order to make a program run other *.exe program and also how to put inputs in it for example i want to to make a program that run...
7
by: mxdevit | last post by:
Task: run application from ASP.NET for example, you have a button on ASP.NET page, when press this button - one application is invoked. the code to run application (for example, notepad) is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.