Error From Simple Statement
Jun 5, 2007
Okay, now I'm suspecting there's more to this than an overly complicated control source statement....
My summary report contains multiple objects that calculate totals based on a statement in their control source. The report ran fine for a few weeks but all of a sudden it started producing this error:
"The expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."
I thought perhaps that 12 lengthy control source statements were simply too much for Access to handle, but then I did some testing and eventually removed all but this control source statement: =Sum([NotifType]=9)
That's about as simple as it gets, but when I try and run the report I still get the error. Ggggrrrrrrrrr....
Can anyone tell me what causes this annoying error and how I can get rid of it? (I already compiled.) What little Access quirk am I running into? I will gladly zip the file and post if necessary.
Thank you.
View Replies
ADVERTISEMENT
Dec 24, 2006
My code abilities are not the best yet...
but I've got this:
="$ " & Sum(tblFinance!Amount WHERE tblFinance.Type="Revenue")
It doesn't work. I'm just trying to display all of the revenues from a table in a sum command. Anyone know how I might be able to fix syntax? thanks!
View 4 Replies
View Related
Jan 31, 2006
Hello,
I have a form based on a table with three controls: txt1, txt2 and txt3. Txt is unbound, while the first two get their source from the table.
I would like that if txt1 is showing data, then txt3 shows the same data of txt2. If this possible?
I have tried something like this but does not work:
If IsNull(Me![txt1]) Then
Me!txt3.Visible = True
If Me!txt1 = "*" Then
Me!txt3 = Me!txt2
End If
End If
View 4 Replies
View Related
Mar 2, 2008
i have an sql statement:
aa = "hello"
Tasklist.RowSource = "SELECT [Tasks].Staff_Name, [Tasks].Project_Title, [Tasks].Percentage_Complete FROM [Tasks] WHERE [Tasks].Date_Allocated < aa ORDER BY [Tasks].Staff_Name;"
how can i make it look the the data i put in "aa" rather than prompt a msg box asking for "aa"?
View 5 Replies
View Related
Oct 26, 2005
Hi.
Select Materials.ID, Materials.AvailableUnits, Substances.Name, Suppliers.CompanyName FROM Materials Right Join Substances on Materials.Substance = Substances.ID
This works in joining the substances.name (from substances table) with the value stored in materials.substance (which is ID of substances.ID)
How can I add another Join to join Suppliers.CompanyName with suppliers.ID. The current Materials.Supplier is a key of Suppliers.ID which holds the value of Suppliers.CompanyName. I've tried this a million times and as soon as I insert a second join, no matter what format I get "syntax error in join statement".
PLEASE PLEASE help!
View 3 Replies
View Related
Sep 20, 2007
I think this would be a simple query but I have not been successful in getting anything to work at this point. So I thought I would through it out to the pro's here! Thanks for any help you might give.
Table looks like this:
EventID EventDate Score EventType
46 09/20/2007 72 1 Day Net
46 09/20/2007 72 2 Day Net - Day 1
46 09/20/2007 68 1 Day Best Ball
48 07/14/2007 69 1 Day Net
48 07/14/2007 34 Nassau
What I am trying to get from this data is the AVG score, but not include Nassau or Best Ball events. So I have used the Not Like "%Nassau%" etc, in ASP (since ASP requires % rather than * like access. The results I would like to see are one score from each DATE avg'd. That means with this sample data we should get...
46 09/20/2007 72 1 Day Net
48 07/14/2007 69 1 Day Net
Avg score 70.5
I don't care to have the Event Type listed, if that causes grouping issues. I just am not getting anything to work. Thanks for any help.
In short If I could get the avg score using only one score a day that is not a Nassau or Best Ball event, I would have to rejoice! Thanks so much.
View 2 Replies
View Related
Jul 29, 2015
I have an open form with buttons to open other forms and use an If statement to position them an example is below.
Code:
Private Sub Command31_Click()
DoCmd.OpenForm "Opener", acNormal
If Me.Frame54 = 1 Then
DoCmd.MoveSize 2500, 1000
ElseIf Me.Frame54 = 2 Then
DoCmd.MoveSize 25500, 1000
End If
End Sub
This works perfectly, however I need to put similar code as a line in a macro and cannot seem to link it.
Code:
Public Function totalmove()
If Forms.Scan_Data.Frame54 = 1 Then
DoCmd.MoveSize 2500, 1000
ElseIf Forms.Scan_Data.Frame54 = 2 Then
DoCmd.MoveSize 24000, 1000
End If
End Function
I get Error 438 object doesn't support this property or method...
View 2 Replies
View Related
Dec 6, 2005
hi all
i have the following peice of code ...
Private Sub NextApplication_Click()
On Error GoTo Err_NextApplication_Click
DoCmd.GoToRecord , , acNext
Exit_NextApplication_Click:
Exit Sub
Err_NextApplication_Click:
If Err.Number = 2105 Then
MsgBox "Cannot navigate to the next record. This is the last record."
Else
MsgBox Err.Description
End If
Resume Exit_NextApplication_Click
End Sub
but even when this error occurs nothing is being properly handled the way i specified - any ideas ?
View 3 Replies
View Related
May 11, 2005
I am designing a table that will be used on a Form...thee will be a series of yes/no questions. I wanted to include a list box that the user adds one or the other. However i can't remember how to do it :D :confused:
All help gratefully received
View 5 Replies
View Related
Apr 5, 2006
i'm not very good at vb and i'm sure this is an easy problem but i can't find the answer.
i have constructed a vb code to show images from a stored table [not OLE linked]:
Private Sub Form_Current()
If Not IsNull(Me.combined_image_path) Then
Me.cempic.Picture = Me.combined_image_path
End If
End Sub
this works fine except when there is no image to show, the last image stays visable. what i want is no image to show if no image is availiabe for that record.
i know that the statement should be constructed along the lines of
'then'
if no image exists then show nothing
'else'
Me.cempic.Picture = Me.combined_image_path
any ideas of what this procedure should be??
thanks
View 2 Replies
View Related
Jul 5, 2006
I got this to work easily on another form but on this particular form it doesnt work. I enter a command button and name it d1, then I enter this code for it to populate the current date in the field next to the box:
Private Sub d1_Click()
Date_Entered.Value = Date
End Sub
Can anyone see why it doesnt work :eek:
ERROR IS:
Run-time error '2465':
Database cant find the field 'Date' referred to in your expression.
When I enter a date field it enders whats in that field (blank) into the field I told it (Date_Entered) on my form.
View 3 Replies
View Related
Sep 2, 2005
I am making a simple tabular form to use as a subform in another.
The form has a cbo box (cboItem_Name)
Quantity (txtQuantity)
Price (txtItem_Cost)
Extended Price (txtExtended_Price)
Selecting an item in the combo puts the price in txtItem_Cost. Default for Quantity is 1. Control Source for txtExtended_Price = [txtQuantity]*[txtItem_Cost] and gives me my extended price.
I have a control in the footer of the form called txtSub_Total. It's Control Source =SUM([txtExtended_Price]).
This Sub Total box generates the #error.
Can anyone tell me why? Do I need to do some other magic with my txtExtended_Price control instead of a simple calculation, like I have?
Thanks for any help you can give a novice.
View 2 Replies
View Related
May 24, 2007
hiya every1, (access 2k3)
quick easy question, as im a noob when it comes to coding/vb.
Within our company database we have the usual timesheet table. With the table I have create a query (called "dailytimeforkeith") that gives me the sum of time for an individual person for one day (in fact its the previous day). What I have done then is created a form (called "keithyesterdaytime") that shows this query entry (called "sumoftimespent").
Each user has a different database screen logon and forms that are present when they log in. So what I then done is on one of these forms the load up, i attached this:
Private Sub Employee_Enter()
Me.Employee = User.FirstName
If Me.Employee = "Keith" Then
Dim stdocname As String
stdocname = "keithyesterdaytime"
DoCmd.OpenForm stdocname, , , acAdd
............
then on "keithyesterdaytime" opening the following code runs
------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
Dim internal1 As Integer
internal1 = Forms!keithyesterdaytime.SumOfTimeSpent
If internal1 < 6 Then
DoCmd.Close
MsgBox " Less than 6 hours have been entered " & Chr(13) & " into your timesheet for yesterday. ", vbCritical, Title1
Else
DoCmd.Close
End If
End Sub
-------------------------------------------------------
Whenever i logon with the user keith, i get the following error 'runtime error 2427: You entered an expression that has no value.
If I open the form "keithyesterdaytime" on its own, the code works and i dont get an error.
What have i done wrong, and be gently. HEHEHE. Also is there any easy way i can do this instead of having to create the the form "keithyesterdaytime"
View 2 Replies
View Related
Nov 3, 2005
SELECT Conversion.[Asset Class], iif([asset class]<4000, "1", "2")
FROM Conversion;
View 2 Replies
View Related
Oct 19, 2007
Hello,
Run-time error ...
No value given one or more required paramete
UPDATE GuitarOptionDetails SET GuitarOptionDetails.OptionCombo = Concatenate("SELECT Option_Item FROM GuitarHeader WHERE GuitarItem & Option_Item =""" & [GuitarOptionDetails].[GuitarItem] & [GuitarOptionDetails].[Option_Item] & """");
basically i need to create an update query to update the OptionCombo field where:
1. OptionCategory=BODY
2. Combine all the BODY OptionItems as one into the OptionCombo field (the Concatenate() function should accomplish this portion)
3. For each InvoiceNumber AND GuitarItem.
NOTE: some invoices will not have any BODY Option_Item, this can place "N" in the OptionCombo BUT only if the invoice does not have a single BODY Option_Item, if it does, it needs to put the combined BODY Option_Item values into the OptionCombo field.
How should I rewrite the SQL to achieve this without getting this error?
View 14 Replies
View Related
Feb 20, 2008
Hi,
I need help with the following question.
I got the following error when loading up a form:
IIf(Not IsNull([SubJobName]) Or [SubJobName]<>"",[SubJobName],[JobName]) AS Expr1, [SubJobs].Status
Can you have IIF statement in the query expression? because it said "Syntax
error in string in the above query expression".
The full codes i have in the form load is
Private Sub Form_Load()
strSQL = "SELECT [Jobs].JobID, [SubJobs].IndustryNo, [SubJobs].ClientNo, [SubJobs].JobNo, [SubJobs].SubJobNo, IIf(Not IsNull([SubJobName]) Or [SubJobName]<>"",[SubJobName],[JobName]) AS Expr1, [SubJobs].Status"
strSQL = strSQL & " FROM [SubJobs] INNER JOIN [Jobs] ON ([SubJobs].JobNo = [Jobs].JobNo) AND ([SubJobs].ClientNo = [Jobs].ClientNo) AND ([SubJobs].IndustryNo = [Jobs].IndustryNo)"
strSQL = strSQL & " WHERE ((([SubJobs].Status) = -1))"
Me!ListBox_Jobs.RowSource = strSQL
End Sub
Thank you in advance
View 1 Replies
View Related
Aug 24, 2005
Hi everyone,
I keep getting this error whenever i try to run the ASPcode. Can anyone please help me
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in UPDATE statement.
I have two tables data1 and data2 in the same access database (data.mdb)
here is the query
strDBPath = Server.MapPath("data.mdb")
Set cnnSimple = Server.CreateObject("ADODB.Connection")
cnnSimple.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
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
View 2 Replies
View Related
Aug 25, 2006
im trying to update to the database with the following sql statements:
FUNCTION fixQuotes( theString )
fixQuotes = REPLACE( theString, "'", "''" )
END FUNCTION
sql #1
sqlstring = "update Asset set AssetID='"&fixQuotes( assetid )&"', AssetLabel='"&fixQuotes( assetlabel )&"', WarrantStart='"&fixQuotes( warrantystart )&"', Engrave='"&fixQuotes( engrave )&"', Status='"&fixQuotes( status1 )&"', Make='"&fixQuotes( make )&"', Model='"&fixQuotes( model )&"', AssetCategory='"&fixQuotes( assetcategory )&"' where AssetID='"&assetid&"' "
sql #2
sqlstring = "update Asset set " &_
"AssetID=' " & fixQuotes( assetid ) & "'," &_
"AssetLabel=' " & fixQuotes( assetlabel ) & "'," &_
"WarrantStart=' " & fixQuotes( warrantystart ) & "'," &_
"Engrave=' " & fixQuotes( engrave ) & "'," &_
"Status=' " & fixQuotes( status1 ) & "'," &_
"Make=' " & fixQuotes( make ) & "'," &_
"Model=' " & fixQuotes( model ) & "'," &_
"AssetCategory=' " & fixQuotes( assetcategory ) & "' where " &_
"AssetID=" & AssetID
ive tried both @ different times but they dont work. the adodb connection's open
View 14 Replies
View Related
Feb 1, 2007
What is the syntax error in this Insert Into statement ?
INSERT INTO RawData(RunID,fullName,name,category,type,subType, numberOfLines,virtual,date,namespace) SELECT 257 ,fullName,name,category,type,subType,numberOfLines ,virtual,#1/3/2007#,namespace FROM RawData WHERE namespace ='customer.demo' AND RunID =256
View 2 Replies
View Related
Aug 29, 2007
Hello,
I'm new to working with Access Iif statements. I'm attempting to change data values in an existing table for column named "Status." Some of the data in this column has the correct value (Active) that needed represented, while the rest is populated with either a "J" which is Active or "T" which is inactive. I needed an update query that will ignore any values that are already "Active," and convert any values that are "J" to Active and values that are "T" to "Non Active." Any help would be greatly appreciated. Below is the function I have written that's full of syntax errors:
IIf(([STATUS] T,"T") = "T", then "Non Active"), IIf([STATUS] J,"J") = "J" then "Active"), else Active = "Active"))
View 11 Replies
View Related
Mar 16, 2005
Good day,
I was wondering if I can get some help with my sql statement, b/c I am a run-time error. I have attached my db but the statement is as follows:
SqlStr = "INSERT INTO tblpcomaward (recempid, reclname, recfname, recdate, givempid, givelname, givefname, desc, value, rebill, comments) Values" _
& "('" & Forms!frmpcom!txtempid & "', '" & Forms!frmpcom!txtlastname & "','" & Forms!frmpcom!txtfirstname & "', #" & Forms!frmpcom!txtdategiven & "#," _
& "'" & Forms!frmpcom!txtgiverempid & "', '" & Forms!frmpcom!txtgivelname & "', '" & Forms!frmpcom!txtgivefname & "', '" & Forms!frmpcom!cbodesc & "', '" & Forms!frmpcom!txtvalue & "', '" & Forms!frmpcom!cborebill & "', '" & Forms!frmpcom!txtcomments & "')"
Thanks for any help.
View 4 Replies
View Related
Mar 21, 2005
Good day,
I had a post last week with this same problem. Last time I was using a reserved word but I have ruled it out with this database because I changed every field name and I still get the error. I think it may have to do with the combo boxes I am using, but not really sure why I am getting the error. Any help would be great. The sql statement is:
SqlStr = "INSERT INTO tblec (cbo1c, cbo2c, cbo3c, cbo4c, cbo5c, cbo6c, cbo7c, cbo8c, cbo9c, cbo10c, cbo11c, cbo12c, cbo13c, cbo14c, cbo15c, cbo16c cbo17c, cbo18c, cbo19c, submdate, ectl) Values" _
& "('" & Forms!frmenrollcenter!cbo1c & "', '" & Forms!frmenrollcenter!cbo2c & "','" & Forms!frmenrollcenter!cbo3c & "', '" & Forms!frmenrollcenter!cbo4c & "'," _
& "'" & Forms!frmenrollcenter!cbo5c & "', '" & Forms!frmenrollcenter!cbo6c & "', '" & Forms!frmenrollcenter!cbo7c & "', '" & Forms!frmenrollcenter!cbo8c & "'," _
& "'" & Forms!frmenrollcenter!cbo9c & "', '" & Forms!frmenrollcenter!cbo10c & "', '" & Forms!frmenrollcenter!cbo11c & "', '" & Forms!frmenrollcenter!cbo12c & "'," _
& "'" & Forms!frmenrollcenter!cbo13c & "', '" & Forms!frmenrollcenter!cbo14c & "', '" & Forms!frmenrollcenter!cbo15c & "', '" & Forms!frmenrollcenter!cbo16c & "', '" & Forms!frmenrollcenter!cbo17c & "', '" & Forms!frmenrollcenter!cbo18c & "', '" & Forms!frmenrollcenter!cbo19c & "', #" & Forms!frmenrollcenter!txtsubmdate & "#, '" & Forms!frmenrollcenter!txtectl & "')"
View 4 Replies
View Related
Jun 27, 2005
Hello,
Hopefully this is an easy one! but for the life of me i can't see what im doing wrong , help is appreciated.
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in UPDATE statement.
/diary_editE.asp, line 272
SQL = "UPDATE diary SET dte =" & Request.Form("dte") & ", " &_
" eTime= '"& ChkStr(Request.Form("tim")) & "', " & _
" eEnd= '"& ChkStr(Request.Form("endt")) & "', " & _
" text_field = '" & ChkStr(Request.Form("title")) & "', " & _
" eLocation = '" & ChkStr(Request.Form("locat")) & "', " & _
" eContact = '" & ChkStr(Request.Form("conta")) & "', " & _
" eSpeak = '" & ChkStr(Request.Form("speak")) & "', " & _
" eAudiin = '" & ChkStr(Request.Form("audi")) & "', " & _
" eAudiex = '" & ChkStr(Request.Form("aude")) & "', " & _
" eVisitors = '" & ChkStr(Request.Form("evisit")) & "', " & _
" ePromo = '" & ChkStr(Request.Form("prom")) & "', " & _
" details = '" & ChkStr(Request.Form("details")) & "', category = " & Request.Form("cat") & _
" WHERE id = " & Request.Form("ID")
my_conn.Execute SQL
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
Thanks in advance
View 3 Replies
View Related
Dec 9, 2014
sort this error out:
Code:
If Nz(DCount("*", "[Tblupdate]")) = 0 Then ' The count is zero
i = 1
Else
i = DMax("ID", "tblupdate")
End If
Dim ssql As String
Dim j, k As String
j = "P" & i
k = Environ("username")
ssql = "Insert into tblUpdate(Update_ID,Date,Username) values('" & j & "',#" & Format(Date, "dd/mm/yyyy") & "#,'" & k & "')"
CurrentDb.Execute ssql, dbFailOnError
View 2 Replies
View Related
Jun 1, 2005
Hi everyone,
I'm trying to execute an update query by using the DoCmd.RunSQL. Here is my statement:
DoCmd.RunSQL "UPDATE T_Facturation SET TotalQuantiteDiesel = TotalQuantiteDiesel + " & Me.TxtQuantiteDiesel.Value & ", " & _
"TotalInst = TotalInst + " & Me.TxtInst.Value & ", TotalDemo = TotalDemo + " & Me.TxtDemo.Value & ", " & _
"TotalCoutDiesel = TotalCoutDiesel + " & Me.TxtCoutDiesel.Value & ", TotalLocationHQ = TotalLocationHQ + " & Me.TxtLocationHQ.Value & ", " & _
"TotalTempsHQ = TotalTempsHQ + " & Me.TxtTempHQ.Value & ", TotalLocation = TotalLocation + " & Me.TxtLocation.Value & ", " & _
"TotalTransfo = TotalTransfo + " & Me.TxtTransfo.Value & ", TotalAutreDep = TotalAutreDep + " & Me.TxtAutresDep.Value & ", " & _
"TotalCable = TotalCable + " & Me.TxtCable.Value & ", TotalElectricien = TotalElectricien + " & Me.TxtElectricien.Value & ", " & _
"TotalTempExt = TotalTempExt + " & Me.TxtTempsExt.Value & ", " & _
"TotalTransportGeneratrice = TotalTransportGeneratrice + " & Me.TxtTransportGeneratrice.Value & ", " & _
"TotalTransportTransfo = TotalTransportTransfo + " & Me.TxtTransportTransfo.Value & " WHERE NoAutoInstallation = '" & Me.TxtNoAutoInstallation.Value & "';"
My problem is that when I execute this code, I got the error:
Run-time error '3464': Data type mismatch in criteria expression.
I tried to change my query statement, but I cannot find my error. I'm using Access 2003. I'm really lost.
Can someone help me please!
Thanks a lot
View 2 Replies
View Related
Feb 7, 2006
Anybody see anything wrong the syntax for the below query. I'm trying set up this query
to pass a string to 'struser' for multiple users. I'm getting 'Syntax error in FROM
clause'. Thanks ! ! !
Dim strSQL As String
Dim struser As String
struser = "MIKE"
Set db = CurrentDb()
Set qdf = db.QueryDefs("qryUser")
strSQL = "SELECT Salable_Figures.Loan_Originator_Code," & _
"Salable_Figures.Loan_Originator_Name," & _
"Salable_Figures.Lastname_Sort," & _
"Salable_Figures.Team, Salable_Figures.Plan," & _
"Salable_Figures.Monthly_SCountOfLoan_Program_Code AS Monthly_SCount, " & _
"Salable_Figures.Monthly_SSumOfNote_Amount," & _
"Salable_Figures.Salable_Monthly_Goal," & _
"Salable_Figures.YTD_SCountOfLoan_Program_Code AS Yearly_SCount," & _
"Salable_Figures.YTD_SSumOfNote_Amount AS Yearly_SSumOfNote_Amount, " & _
"Salable_Figures.YTD_SSumOfNote_Amount AS Yearly_SSumOfNote_Amount," & _
"Salable_Figures.Yearly_Salable AS Yearly_Salable_Goal " & _
"FROM Salable_YTD_Figures INNER JOIN Salable_Figures" & _
"ON Salable_YTD_Figures.Loan_Originator_Code = Salable_Figures.Loan_Originator_Code " & _
"WHERE Salable_Figures.Loan_Originator_Code)=" & struser & _
"';'"
' Apply the new SQL statement to the query
qdf.SQL = strSQL
' Open the query
DoCmd.OpenQuery "qryUser"
View 1 Replies
View Related