473,467 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Run-Time Error '424 - Object Required

48 New Member
Good Morning Experts,

I spent all weekend working on this and got absolutely no where.

I have a database with an input form that runs an append query to append to a table.

Form Name: Poetry
Append Query Name: Created_Submitted_Work
Table Name: Created_Submitted

I have also created what I hope is an update query. The purpose of this query is to check whether a record exists that contains the words “Not Applicable” in the table field [Submitted To]. I am trying to test this in stages by verifying I can examine the table field for “Not Applicable” in the (Created_Submitted.[Submitted To]) field after clicking the Add Record command button.

I am constantly getting the message “Run-Time Error '424 - Object Required”. But I don’t know what it is referring to. I assume it is not able to access the table to verify the field contents. If that is the case I have no idea how to make it happen. If that is not the case, then again, I have no idea what is causing this.

I have commented out everything in the event and am just trying to do s simple if statement to see if it works.

Here is what I used to test that:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CMD_AddRecord2_Click()
  2. If (Created_Submitted.[Submitted To]) = "Not Applicable" Then
  3.        MsgBox "This Worked!", vbOK, "Woo Hoo!!!"
  4.     End If
  5. End Sub
Any help would be greatly appreciated.
May 12 '08 #1
11 6079
nico5038
3,080 Recognized Expert Specialist
Did you try:
Expand|Select|Wrap|Line Numbers
  1. Private Sub CMD_AddRecord2_Click()
  2. If mE.[Submitted To] = "Not Applicable" Then
  3.    MsgBox ("This Worked!", vbOK, "Woo Hoo!!!")
  4. End If
  5. End Sub
This assumes that the code is behind a form and the field is named [Submitted To] (Check the name in the Other tab of the properties window).
For referring to the field in a table a Dlookup() statement is needed.

Nic;o)
May 12 '08 #2
dougmeece
48 New Member
Thank Nico,,

I tried using the code below and received a differnet message.

Expand|Select|Wrap|Line Numbers
  1. Private Sub CMD_AddRecord2_Click()
  2.     Dim subTo As Variant
  3.         subTo = DLookup("[Submitted To]", "Created_Submitted", "[Title] = " _
  4.         & Forms!Poetry!TxtTitle)
  5. End Sub
  6.  
When I ran this just to see if it would error I received the message "Run-time error 3075 - Syntax error (missing operator) in query expression '[Title] = Blue Jean Hoochie Mama'" . In this error Blue Jean Hoochie Mama is the name of a poem that is in the table. I want to look up the values for the Submitted To field in the Created_Submitted table where the Title field in the same table is equal to the TxtTitle field on the form Poetry.

I have tried looking up this error and found information referrinfg the apostrophes and such but the value selected does not contain any.

Thoughts???

Thanks,
Doug
May 12 '08 #3
nico5038
3,080 Recognized Expert Specialist
Thank Nico,,

I tried using the code below and received a differnet message.

Expand|Select|Wrap|Line Numbers
  1. Private Sub CMD_AddRecord2_Click()
  2.     Dim subTo As Variant
  3.         subTo = DLookup("[Submitted To]", "Created_Submitted", "[Title] = " _
  4.         & Forms!Poetry!TxtTitle)
  5. End Sub
  6.  
When I ran this just to see if it would error I received the message "Run-time error 3075 - Syntax error (missing operator) in query expression '[Title] = Blue Jean Hoochie Mama'" . In this error Blue Jean Hoochie Mama is the name of a poem that is in the table. I want to look up the values for the Submitted To field in the Created_Submitted table where the Title field in the same table is equal to the TxtTitle field on the form Poetry.

I have tried looking up this error and found information referrinfg the apostrophes and such but the value selected does not contain any.

Thoughts???

Thanks,
Doug
Strings need to be embedded in quotes like:
Expand|Select|Wrap|Line Numbers
  1. Private Sub CMD_AddRecord2_Click()
  2.     Dim subTo As Variant
  3.         subTo = DLookup("[Submitted To]", "Created_Submitted", "[Title] = '" _
  4.         & Forms!Poetry!TxtTitle) & "'"
  5. End Sub
  6.  
The single quotes ( ' ) are hard to see, but they need to be in the WHERE parameter for every text field. Dates need surrounding #'s and numbers need nothing.

Nic;o)
May 12 '08 #4
dougmeece
48 New Member
I got the exact same error message. I moved the right parantheses to the very end of the code you sent and got further. the problem there was that the update query wanted to update all the records whether the title field in the table matched to txttitle filed on the form or not.

I added an If statement to test it and opened up some of the code.

Expand|Select|Wrap|Line Numbers
  1. Private Sub CMD_AddRecord2_Click()
  2. On Error GoTo Err_CMD_Add_Record2_Click
  3.  
  4.     Dim subTo As Variant
  5.  
  6.         subTo = DLookup("[Submitted To]", "Created_Submitted", "[Title] = '" _
  7.         & Forms!Poetry!TxtTitle & "'")
  8.  
  9.     If subTo = "Not Applicable" Then
  10.  
  11.         Dim stUpdate As String
  12.         stUpdate = "Created_Submitted_Query"
  13.         DoCmd.OpenQuery stUpdate, acNormal, acEdit
  14.  
  15.         CMD_Cancel.Visible = True
  16.         cmdSpecificSearch.Visible = True
  17.         lblSubmissionDetails.Visible = False
  18.         lblSubmittedTo.Visible = False
  19.         cboSubmitted.Visible = False
  20.         lblWebsite.Visible = False
  21.         TxtWebsite.Visible = False
  22.         lblType.Visible = False
  23.         TxtType.Visible = False
  24.         lblDateSubmitted.Visible = False
  25.         TxtDate.Visible = False
  26.         lblDateAdded.Visible = False
  27.         TxtDate2.Visible = False
  28.         lblAccepted.Visible = False
  29.         cboAccepted.Visible = False
  30.         CMD_Cancel.SetFocus
  31.         CMD_AddRecord2.Visible = False
  32.         CMD_Cancel2.Visible = False
  33.         CMSAllRecords.Visible = True
  34.         Me![cboTitles] = ""
  35.         Me![TxtYearCreated] = ""
  36.         Me![cboSubmittedBox] = ""
  37.         Me![cboSubmitted] = ""
  38.         Me![TxtWebsite] = ""
  39.         Me![TxtType] = ""
  40.         Me![TxtDate] = ""
  41.         Me![TxtDate2] = ""
  42.         Me![cboAccepted] = ""
  43.  
  44.     End If
  45.  
  46. Exit_CMD_Add_Record2_Click:
  47.     Exit Sub
  48.  
  49. Err_CMD_Add_Record2_Click:
  50.     MsgBox Err.Description
  51.     Resume Exit_CMD_Add_Record2_Click
  52.  
  53. End Sub
  54.  
May 12 '08 #5
nico5038
3,080 Recognized Expert Specialist
The UPDATE query needs to hold the unique key.
Personally I use often:
Expand|Select|Wrap|Line Numbers
  1. curentdb.execute ("UPDATE tblX SET Field1 = '" & Me.FieldFromForm & "' WHERE ID=" & Me.ID)
  2.  
Nic;o)
May 12 '08 #6
dougmeece
48 New Member
Thanks. I will try that tomororw, but I really have no idea where it goes in my code. I will have to research it in the morning.
May 12 '08 #7
nico5038
3,080 Recognized Expert Specialist
Would be after the IF statement:

If subTo = "Not Applicable" Then

use it instead of running the UPDATE query.

Nic;o)
May 12 '08 #8
dougmeece
48 New Member
I apologoze but I don't understand all of it. I am really struggling with this one and I don't really know why.

WHAT YOU SENT
Expand|Select|Wrap|Line Numbers
  1. curentdb.Execute ("UPDATE tblX SET Field1 = '" & Me.FieldFromForm & "' WHERE ID=" & Me.ID)
WHAT I THINK I NEED (I have bolded what I do not understand)
Expand|Select|Wrap|Line Numbers
  1. curentdb.Execute ("UPDATE Created_Submitted SET Field1 = '" & Me.TxtTitle & "' WHERE ID =" & Me.ID)
Do I need to replace Field1 with something else?
Is Where ID supposed to be the field in the table (Title) and Me.ID supposed to be the form field again?

Again, sorry for my ignorance.

Thanks,
Doug
May 13 '08 #9
dougmeece
48 New Member
I read online that Access 2000 and 2002 will not allow the Currentdb command to work. I am using Access 2003 Sp3 on an XP machine. Do you think this be a problem for me?

Would be after the IF statement:

If subTo = "Not Applicable" Then

use it instead of running the UPDATE query.

Nic;o)
May 13 '08 #10
nico5038
3,080 Recognized Expert Specialist
My line of code is a sample, as I don't know the table and field(s) you use.
Just open the helpfile to see the syntax and to replace my sample names with the names you need.
The ID field should be the unique identifier of the row in the table, else all rows are updated...

Nic;o)
May 13 '08 #11
NeoPa
32,556 Recognized Expert Moderator MVP
I read online that Access 2000 and 2002 will not allow the Currentdb command to work. I am using Access 2003 Sp3 on an XP machine. Do you think this be a problem for me?
No, I doubt this will be a problem.

What you should understand if you're setting up multiple fields is that your UPDATE SQL string will have to include a {[Field]=Value,} for EACH of the fields to be updated.

Are you getting the picture Doug?
May 13 '08 #12

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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.