I'm trying to write an UPDATE line in VBA, but whenever I put the table name I get an "Expected End of Statement" error.This is line currently;
Code: strSQL = UPDATE "MASTER PLANNER" SET [SET 2] = TRUE WHERE "[ID] = " & Me.PlannerID
It doesn't matter whether I change the table name to square brackets, quotes or nothing at all, it always gives me the expected end of statement error.
I changed one of my queries to generate the period off a date in a field. The simple expression is:
Period: Month([Act Del])
It give me the number of the month...however now I am getting this error. I assume that the number of the month is not matching with the other data types....but I need to know who to fix it.
order_id is an autonumber key field form table Orders_table. Is is also selected in the row.source for the form I am using. ComboOrder_ID is a combo box that looks up the order_id from the table with a SELECT... ... So I think the two should be the same datatype!
When I set the order_id in the combo the event procedure runs I get the following debug error:- Runtime error '3464': Datatype mismatch in criteria expression
This is the code for the after event on that combobox: [code] Private Sub ComboOrder_ID_AfterUpdate() ' Find the record that matches the control. Dim rs As Object Set rs = Me.Recordset.Clone rs.FindFirst "orders_table.order_id = '" & Me![ComboOrder_ID] & "'" If rs.NoMatch Then MsgBox "it's the <find> that is broken" Else Me.Bookmark = rs.Bookmark End Sub [end code] Any help is much appreciated Thx. Kev.
Run into a bit of an issue with a combo box that has dates. When I click on a date I receive:
Run-time error '3464': 'Data type mismatch in criteria expression'
Am I receiving this because I have declared it a string when I should declare it something else?
My other question for whenever I get the first part fixed. Is there a way that instead of having all the possible dates to select from, that I could simply have three options available: Within a year, More than a year, and no date. (Once I click on one of those three options, I will filter records that have a date within the past year, over a year, or no date at all. How would I be able to achieve this?
Set rstSimple = cnnSimple.Execute("SELECT sponser2 FROM data2")
Do While Not rstSimple.EOF spo=rstSimple.Fields("sponser2").Value set tamt = cnnsimple.Execute("SELECT SUM(amount1) FROM data1 WHERE sponser1='"&spo&"' ") Set rstSimple1 = cnnSimple.Execute("UPDATE data2 SET amount2= "&tamt(0)&" WHERE sponser2='"&spo&"' ") rstSimple.MoveNext Loop
I am currently creating a form which includes a command button to update a field in a table to show Today's Date, at the time of running a query I am still yet to write.
I have the following code for my Command Button, which is returning the Runtime Error 3464 (Data type mismatch in Criteria Expression):
Private Sub cmdAddTodaysDate_Click() CurrentDb.Execute (" UPDATE tblMyTable SET TodaysDate = " & Date & " WHERE tblMyTable.ProductCode = " & Me.txtProductCode) End Sub
The query above seems to be having issues matching the text from the 'txtProductCode' textbox to the table field 'ProductCode'.
When I try to open a recordset based on this sql, it gives me the runtime error - which is odd since I don't have any criteria in the statement.
I think the problem may be that vba is somehow adding a line break between "fullvals" and "18", but I don't know why it would do so and it doesn't always (only if the string is long).
If anymore info is required please tell me, but basically i can insert into the database no problems , but when it comes to updating what is in there i recieve the above error
I have 2 tables called MakeTable1 and DBO_TBL_Activity
Im trying to update MakeTable1 with the values from TBL_Activity when both activity.StartDate and maketable1.Dates match but also acticity.IDStaff and Maketable1.ID Match
Below is the SQL i have so far
Code:
UPDATE [MakeTable1].[Detailsa] SET [dbo_tbl_activity].[details]
WHERE [MakeTable1.Dates)=[dbo_tbl_activity].[StartDate] AND [MakeTable1].[id]=[dbo_tbl_activity].[idstaff]);
My issue is that I am trying to update a date field. When I do the date field may have a date or may be a null. When I try to pass in a NULL date with no quotes, I get a syntax error. When I have single quotes in the statement and a null value is passed in, I get an invalid use of date.
Dim DENIEDDATE1 As Date If (Not IsDate(rs.Fields("DENIED_DATE"))) Then DENIEDDATE1 = Null Else DENIEDDATE1 = "'" & rs.Fields("DENIED_DATE") & "'" End If
update table1 set table1.denieddate = " & denieddate1 & " 'get Update syntax error with this statement update table1 set table1.denieddate = '" & denieddate1 & "' 'fails due to invalid use of null
I'm trying to create a function to update and amend records in a table.
The update part works and updates existing records with new data but I'm getting an error with the insert part.
Run time error 3078 The Microsoft Office Access database engine cannot find the input table or query 'FALSE'. Make sure it exists and that its name is spelled correctly.
Nothing called 'FALSE' so not sure what that means?
I am trying to update the fields of a table from comboboxes and textboxes on a form. I don't want all the fields to receive data from the objects on my form directly. Some of the bound controls are not visible and data would be entered into them from visible comboboxes instead. I am not sure exactly how to do that. I tried to devise a query that would take the values from the comboboxes and equate them to those of the hidden controls, but that didn't work. I tried inserting an update command in code but that came up with an error. If some one could help me I would be thankful.
Microsoft JET Database Engineerror '80040e14' Syntax error in INSERT INTO statement. /PeriodicWorkScheduleRatingSubmit.asp, line 65
I tried doing a response.write onto the ASP (to get the actual SQL), got the query, copy-pasted it and ran it on MS Access - it worked fine there. The query is -
I am trying to do an update on a table with a query which has a join as follows but getting an error:
UPDATE RoleObjects SET AccessType = 1 FROM RoleObjects INNER JOIN Objects On Objects.ObjectID = RoleObjects.ObjectID WHERE (RoleObjects.RoleID <> 1) AND (MID(Objects.ObjectName, 4, 2) = 'SR')
I tried to debug the code and found that the following part of the code with the Select clause works fine.
SELECT * FROM RoleObjects INNER JOIN Objects On Objects.ObjectID = RoleObjects.ObjectID WHERE (RoleObjects.RoleID <> 1) AND (MID(Objects.ObjectName, 4, 2) = 'SR')
Now, I know that something in the UPDATE statement does not match my select statement.What should my Update Statement be, in order to update all the columns in the joined tables?
I'm trying to run a very basic iif statement to correct hourly data for sorting. Basically, a trading day runs from 8am - 8am, so I need to adjust the hours to ensure that 1am on the 15th trading day (really the 16th on the calendar), comes after 9am on the 15th trading day (which will actually be the 15th on the calendar).
Here's what I've used. It's driving me bananas, because it keeps telling me that there's a syntax error (comma) in the query expression, but I can't understand why?
I would like to have a table update query populate cells in a field, based on an IIf statement (below), but states that the IIf statement arguments still need to be enclosed in parentheses. I don't understand what the problem is, I have two sets of opening / closing parentheses.
SELECT Costs.Costs_Per_Capita, Costs.Period IIF (Period = 1, (Select AVG(Costs_Per_Capita) From Costs Where Period = 1), (Select AVG(Costs_Per_Capita) From Costs Where Period = 2) AS result FROM Costs;
But get "syntax error (missing operator) in a query expression ..."
Does anyone know why I get the error "Operation must use an updateable query" when I run this query.
UPDATE Food_Table SET Food_Table.Delivery_Size = (SELECT Delivery_Size FROM Delivery_Table WHERE ((Delivery_Table.Region=Forms.Formulation_Combo.Re gion_Combo) AND (Delivery_Table.SubRegion=Forms.Formulation_Combo. SubRegion_Combo) AND (Delivery_Table.Segment=Forms.Formulation_Combo.Se gment_Combo) AND (Delivery_Table.Sector=Forms.Formulation_Combo.Sec tor_Combo) AND (Delivery_Table.Product=Forms.Formulation_Combo.Pr oduct_Combo)));
When I run only the sub SELECT query portion all is well, but not in the update query.