Modules & VBA :: Error 3061 - Too Few Parameters
Jul 9, 2013
Access 2003
This statement works great.
Code:
db.Execute "INSERT INTO TBLFILESTEMP (TextFile) VALUES (""" & Replace$(strDelimiter & vbNewLine & var, """", """""") & """);"
I'd like to include FileID (number Long Integer) and use the value from MyForm RecordID (autonumber)
This gives me a Run-Time error '3061': Too few parameters. Expected 1.
Code:
db.Execute "INSERT INTO TBLFILESTEMP (TextFile, FileID) VALUES (""" & Replace$(strDelimiter & vbNewLine & var, """", """""") & """, me.RecordID);"
View Replies
ADVERTISEMENT
Sep 18, 2014
I have been struggling with getting the syntax right for the ConcatRelate function. I have looked at other peoples examples and mine seems to have exactly the same syntax but it is giving me an error.
My Sql is
SELECT qr_RiverGroup.River, ConcatRelated("Site_ID","qr_RiverGroup","[River] = '" & [River] & "'") AS Expr1
FROM qr_RiverGroup;
View 7 Replies
View Related
Sep 9, 2013
I have a library function that will allow the user to nominate a query (as one of its arguments) in the calling application which must have an email field. The function will then Do Loop the email field, concatenating it before creating an email and addressing it. The intended functionality is that a developer can easily create a group email, just by creating a query.
This works fine if the query is filtered "statically" - i.e. I specify which group of people by typing in their "Site_ID" in the criteria. However I want developers to be able to creating dynamically filtered queries (perhaps by the group's ID on a calling form). Within the query (to test it), the filter is therefore [Forms]![Test Function Calls]![Site_id]. When I run the code, I am then presented with "Run-time error 3061: Too few parameters. Expected 1". The code in question is:
Dim rst As DAO.Recordset
Dim stTo As String 'one of the function's arguments received from the calling function.
Dim stToString As String 'the built up concatenated emails
Set rst = CurrentDb.OpenRecordset(stTo, dbOpenDynaset, dbSeeChanges)
[Code] ....
View 6 Replies
View Related
Jul 1, 2005
Hello Access friends,
What is wrong with the following code (modified the module from http://members.iinet.net.au/~allenbrowne/AppInventory.html ):
I Keep getting a runtime error 3061 Too few parameters . Expected 1 on the line highlight below.
I have the reference MS DAO 3.6 selected and I am using access 2000 and calling the module from a command button in a form.
Thanks in advance for taking the time to help me out.
Dim db As DAO.Database 'CurrentDb()
Dim rs As DAO.Recordset 'Various recordsets.
Dim strProduct As String 'vProductID as a string.
Dim strAsOf As String 'vAsOfDate as a string.
Dim strSTDateLast As String 'Last Stock Take Date as a string.
Dim strDateClause As String 'Date clause to use in SQL statement.
Dim strSQL As String 'SQL statement.
Dim lngQtyLast As Long 'Quantity at last transaction.
Dim lngQtyAcq As Long 'Quantity acquired since incoming transaction.
Dim lngQtyUsed As Long 'Quantity used since outgoing transaction.
If Not IsNull(vProductID) Then
'Initialize: Validate and convert parameters.
Set db = CurrentDb()
strProduct = vProductID
If IsDate(vAsOfDate) Then
strAsOf = "#" & Format$(vAsOfDate, "mm/dd/yyyy") & "#"
End If
'Get the last transaction date and quantity for this product.
If Len(strAsOf) > 0 Then
strDateClause = " AND ([TransacDate] <= " & strAsOf & ")"
End If
strSQL = "SELECT TOP 1 [TransacDate], [Quantity] FROM [Transactions] " & _
"WHERE ((ProductID = " & strProduct & ")" & strDateClause & _
") ORDER BY TransacDate DESC;"
Set rs = db.OpenRecordset(strSQL)
With rs
If .RecordCount > 0 Then
strSTDateLast = "#" & Format$(![TransacDate], "mm/dd/yyyy") & "#"
lngQtyLast = Nz(!Quantity, 0)
End If
End With
rs.Close
'Build the Date clause
If Len(strSTDateLast) > 0 Then
If Len(strAsOf) > 0 Then
strDateClause = " Between " & strSTDateLast & " And " & strAsOf
Else
strDateClause = " >= " & strSTDateLast
End If
Else
If Len(strAsOf) > 0 Then
strDateClause = " <= " & strAsOf
Else
strDateClause = vbNullString
End If
End If
'Get the quantity acquired since then.
strSQL = "SELECT Sum([Transactions].[Quantity]) AS QuantityAcq " & _
"FROM [Transactions]" & _
"WHERE (([Transactions].[ProductID] = " & strProduct & ") AND ([Transactions].[TransacType] = 'Incoming')"
If Len(strDateClause) = 0 Then
strSQL = strSQL & ");"
Else
strSQL = strSQL & " AND ([Transactions].[TransacDate] " & strDateClause & "));"
End If
Set rs = db.OpenRecordset(strSQL)
If rs.RecordCount > 0 Then
lngQtyAcq = Nz(rs!QuantityAcq, 0)
End If
rs.Close
'Get the quantity used since then.
strSQL = "SELECT Sum([Transactions].[Quantity]) AS QuantityUsed " & _
"FROM [Transactions]" & _
"WHERE (([Transactions].[ProductID] = " & strProduct & ") AND ([Transactions].[TransacType] = 'Outgoing')"
If Len(strDateClause) = 0 Then
strSQL = strSQL & ");"
Else
strSQL = strSQL & " AND ([Transactions].[TransacDate] " & strDateClause & "));"
End If
Set rs = db.OpenRecordset(strSQL)
If rs.RecordCount > 0 Then
lngQtyUsed = Nz(rs!QuantityUsed, 0)
End If
rs.Close
'Assign the return value
OnHand = lngQtyLast + lngQtyAcq - lngQtyUsed
End If
Set rs = Nothing
Set db = Nothing
Exit Function
End Function
View 3 Replies
View Related
Jun 15, 2005
I am running this code, and i am getting this error:
Code:Private Sub SendFormToConsultants_Click() On Error GoTo Err_SendFormToConsultants_Click Dim stWhere As String '-- Criteria for DLookup Dim varTo As Variant '-- Address for SendObject Dim stText As String '-- E-mail text Dim stSubject As String '-- Subject line of e-mail Dim stCOFNumber As String '-- The COF Number from form Dim stCustomerID As String '-- The Customer ID from form Dim stCompanyName As String '-- The Company Name from form Dim stContactName As String '-- The Contact Name from form Dim stAddress As String '-- The Company Address from form Dim stTRDW As String '-- The TRDW from form Dim stPreReq As String '-- The PreReq from form Dim stWorkLoc As String '-- The Location of Work from form Dim stDelivActiv As String '-- The Deliverables/Activities from form Dim stStartDate As Date '-- The Start Date from Subform Dim stEndDate As Date '-- The End Date from Subform Dim stWho As String '-- Reference to Resources Dim strSQL As String '-- Create SQL update statement Dim errLoop As Error '-- Combo of names to assign COF to stWho = Me.COF_Scheduled__Assigned_Resources__Subform1!Res ourceName stWhere = "Resources.ResourceName = " & "'" & stWho & "'" '-- Looks up email address from Resources varTo = DLookup("[ResourceEmail]", "Resources", stWhere) stCOFNumber = Me!COFNumber stCustomerID = Me.Consultancy_Order_Form_CustomerID stCompanyName = Me.CompanyName stContactName = Me!COFContact stAddress = Me.Address stTRDW = Me.TRDW stPreReq = Me.PreRequisites stWorkLoc = Me.WorkLocation stDelivActiv = Me.DeliverablesActivities stStartDate = Me.COF_Scheduled__Assigned_Resources__Subform1!Sta rtDate stEndDate = Me.COF_Scheduled__Assigned_Resources__Subform1!End Date stSubject = ":: New Consultancy Order Assigned ::" stText = "You have been assigned a new Consultancy Order." & vbCrLf & _ "Consultancy Order Form Number: " & stCOFNumber & _ vbCrLf & _ "Company ID: " & stCustomerID & _ vbCrLf & _ "Company Name: " & stCompanyName & _ vbCrLf & _ "Contact Name: " & stContactName & _ vbCrLf & _ "Address: " & stAddress & _ vbCrLf & _ "Terms of Reference / Description of Work: " & stTRDW & _ vbCrLf & _ "Pre-Requisites: " & stPreReq & _ vbCrLf & _ "Location of Work: " & stWorkLoc & _ vbCrLf & _ "Deliverables / Activities: " & stDelivActiv & _ vbCrLf & _ "Start Date: " & stStartDate & _ vbCrLf & _ "End Date: " & stEndDate & _ vbCrLf & _ "Please reply to confirm Consultancy Order Assignment." 'Write the e-mail content for sending to Consultant DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1 'Set the update statement to disable command button once e-mail is sent strSQL = "UPDATE [Consultancy Order Form] SET [Consultancy Order Form].COFSentToConsultants = 0 " & _ "Where [Consultancy Order Form].COFNumber = " & Me!COFNumber & ";" On Error GoTo Err_Execute CurrentDb.Execute strSQL, dbFailOnError On Error GoTo 0 'Requery checkbox to show checked 'after update statement has ran 'and disable send mail command button Me!COFSentToConsultants.Requery Me!COFSentToConsultants.SetFocus Me.SendFormToConsultants.Enabled = False Exit SubErr_Execute: ' Notify user of any errors that result from ' executing the query. If DBEngine.Errors.Count > 0 Then For Each errLoop In DBEngine.Errors MsgBox "Error number: " & errLoop.Number & vbCr & _ errLoop.Description Next errLoop End If Resume NextExit_SendFormToConsultants_Click: Exit SubErr_SendFormToConsultants_Click: MsgBox Err.Description Resume Exit_SendFormToConsultants_ClickEnd Sub
What does it mean? it doesn't say where i have a problem in my code. What do you think?
View 3 Replies
View Related
Dec 1, 2014
The code below fails.
Code:
Dim ResultQy As String, qdf As QueryDef
Dim ResultFm As String
ResultQy = "ByFederationQy"
Dim strSQL As String 'sql statement to execute
[Code] ....
When I run the code it fails at the last line giving error message:
Code:
Runtime error 3061 - toofew parameters expected 1
View 6 Replies
View Related
Sep 28, 2007
i have a stored query in my database and when i run it from vb code using
DBEngine(0)(0).Execute "QRY_ImportDuplicatesTopLevel", dbFailOnError
i get the message "an error ocurred 3061 - too few paramters expected 1"
which usually means a missing or mispelled field name
however when i run this query by double clincking its icon i get no error and the query returns the appropriate data
does anyone know what may cause this divergent behaviour?
View 1 Replies
View Related
Nov 18, 2004
I am trying to open a recordset object using a reasonably complex query. The query uses other queries to get data and some of these queries are totaliser queries (I dont know the proper terminology but they are the ones that group and sum up data in the query).
Dim D As Database, R As Recordset, R2 As DAO.Recordset
Set D = DBEngine.Workspaces(0).Databases(0)
Set R2 = D.OpenRecordset("Qry Daily Losses", dbOpenSnapshot)
The error Message I get is:
Run-time error "3061"
Too few parameters. Expected 4.
Most of the information I have seen on this error message talks about 1 parameter expected not 4.
I can open the query directly by clicking on it in the objects list and it looks fine. It is only when I try to open it in my code that it goes wrong.
I am using Access 2002 (SP3)
View 2 Replies
View Related
Jan 18, 2006
I have a error I need help with. Here is my code for my Global, and My Form Current: See the red for the Error Line, that show up in the VBE and the Blue is the code related to that line. I am using access 2003
'Declare all variables for right-side record counter
Dim bdg As DAO.Recordset
Dim swr As DAO.Recordset
Dim wtr As DAO.Recordset
Dim dmo As DAO.Recordset
''Dim dvt As DAO.Recordset
Dim occ As DAO.Recordset
Dim fre As DAO.Recordset
Dim swrlat As DAO.Recordset
Dim wrtlat As DAO.Recordset
Dim bdgCount As Integer
Dim swrcount As Integer
Dim wtrcount As Integer
Dim dmocount As Integer
Dim dvtcount As Integer
Dim occcount As Integer
Dim frecount As Integer
Dim countswr As Integer 'laterial counter
Dim countwtr As Integer 'laterial counter
Dim sqlbdg As String
Dim sqlswr As String
Dim sqlwtr As String
Dim sqldmo As String
''Dim sqldvt As String
Dim sqlocc As String
Dim sqlfre As String
Dim sqlswrlat As String
Dim sqlwtrlat As String
Dim db As DAO.Database
Private Sub Form_Current()
Set db = CurrentDb()
'Use SQL strings to pull data from the tables
sqlbdg = "SELECT [Building].[PIN] FROM Building WHERE [Building].[PIN]='" & Me![ADDRESS3] & "' ;"
sqlswr = "SELECT [Sewerform].[PIN] FROM [SEWER SERVICE LATERALS] WHERE [Sewerform].[PIN]='" & Me![ADDRESS3] & "' ;"
sqlwtr = "SELECT [water].[PIN] FROM [WATER SERVICE LATERALS] WHERE [water].[PIN]='" & Me![ADDRESS3] & "' ;"
sqlswrlat = "SELECT [SewerMain].[PIN] FROM [SEWER MAIN PRBLEMS] WHERE [SewerMain].[PIN]='" & Me![ADDRESS3] & "' ;"
sqlwtrlat = "SELECT [WaterMain].[PIN] FROM [WATER MAIN PROBLEMS] WHERE [WaterMain].[PIN]='" & Me![ADDRESS3] & "' ;"
sqldmo = "SELECT [Demolition Permits].[PID] FROM [Demolition Permits] WHERE [Demolition Permits].[PID]='" & Me![ADDRESS3] & "' ;"
''There is no PIN field in the development table ==> sqlwtr = "SELECT [Development Permits].[PIN] FROM [Development Permits] WHERE [Development Permits].[PIN]='" & Me![ADDRESS3] & "' ;"
sqlocc = "SELECT [Occupancy].[PIN] FROM Occupancy WHERE [Occupancy].[PIN]='" & Me![ADDRESS3] & "' ;"
sqlfre = "SELECT [Freeze].[PIN] FROM Freeze WHERE [FREEZE].[PIN]='" & Me![ADDRESS3] & "' ;"
Set bdg = db.OpenRecordset(sqlbdg, dbOpenSnapshot)
Set swr = db.OpenRecordset(sqlswr, dbOpenSnapshot)
Set wtr = db.OpenRecordset(sqlwtr, dbOpenSnapshot)
Set dmo = db.OpenRecordset(sqldmo, dbOpenSnapshot)
''Set dvt = db.OpenRecordset(sqldvt, dbOpenSnapshot)
Set occ = db.OpenRecordset(sqlocc, dbOpenSnapshot)
Set fre = db.OpenRecordset(sqlfre, dbOpenSnapshot)
Set swrlat = db.OpenRecordset(sqlswrlat, dbOpenSnapshot)
Set wrtlat = db.OpenRecordset(sqlwtrlat, dbOpenSnapshot)
'Building recordset
On Error Resume Next
If bdg.EOF And bdg.BOF = True Then
bdgCount = 0
Else
With bdg
.MoveFirst
.MoveLast
bdgCount = .RecordCount
End With
End If
'Sewer recordset
On Error Resume Next
If swr.EOF And swr.BOF = True Then
swrcount = 0
Else
With swr
.MoveFirst
.MoveLast
swrcount = .RecordCount
End With
End If
'Water recordset
On Error Resume Next
If wtr.EOF And wtr.BOF = True Then
wtrcount = 0
Else
With wtr
.MoveFirst
.MoveLast
wtrcount = .RecordCount
End With
End If
'Sewer laterial recordset
On Error Resume Next
If swrlat.EOF And swrlat.BOF = True Then
countswr = 0
Else
With swrlat
.MoveFirst
.MoveLast
countswr = .RecordCount
End With
End If
'Water laterial recordset
On Error Resume Next
If wrtlat.EOF And wrtlat.BOF = True Then
countwtr = 0
Else
With wrtlat
.MoveFirst
.MoveLast
countwtr = .RecordCount
End With
End If
'Demolition recordset
On Error Resume Next
If dmo.EOF And dmo.BOF = True Then
dmocount = 0
Else
With dmo
.MoveFirst
.MoveLast
dmocount = .RecordCount
End With
End If
'Development recordset
''On Error Resume Next
''If dvt.EOF And dvt.BOF = True Then
dvtcount = 0
''Else
''With dvt
'' .MoveFirst
'' .MoveLast
'' dvtcount = .RecordCount
''End With
''End If
'Occupancy recordset
On Error Resume Next
If occ.EOF And occ.BOF = True Then
occcount = 0
Else
With occ
.MoveFirst
.MoveLast
occcount = .RecordCount
End With
End If
'Freeze recordset
On Error Resume Next
If fre.EOF And fre.BOF = True Then
frecount = 0
Else
With fre
.MoveFirst
.MoveLast
frecount = .RecordCount
End With
End If
'Set the values of the recordcounts to the appropriate text boxes
txtbdgcount.SetFocus
txtbdgcount.Text = bdgCount
txtswrcount.SetFocus
txtswrcount.Text = swrcount
txtwtrcount.SetFocus
txtwtrcount.Text = wtrcount
txtdmocount.SetFocus
txtdmocount.Text = dmocount
txtdvtcount.SetFocus
txtdvtcount.Text = dvtcount
txtocccount.SetFocus
txtocccount.Text = occcount
txtfrecount.SetFocus
txtfrecount.Text = frecount
txtcountswr.SetFocus
txtcountswr.Text = countswr
txtcountwtr.SetFocus
txtcountwtr.Text = countwtr
PARID.SetFocus
' Provide a record counter for using with
' custom navigation buttons (when not using
' Access built in navigation)
Dim rst As DAO.Recordset
Dim lngCount As Long
Set rst = Me.RecordsetClone
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
'Show the result of the record count in the text box (txtRecordNo)
Me.Text34 = "Record " & Me.CurrentRecord & " of " & lngCount
End Sub
View 6 Replies
View Related
Nov 7, 2004
Hello. I am trying to sort this out and hope someone can help.
Using Access 2002 front end, sqlserver 2000 back end.
In my front end database I have a query called "queEEGBilling" that is used to populate a report. It is quite a complex query which I did using the query designer, NOT with a WHERE sql command. I am not very good with SQL syntax.
The report works fine, and displays the records I want it to display.
However, after the report is displayed, I want to modify one field in each record to indicate that the report for hat record has been printed out (it is a billing package, and I want to indicate that the bill has been sent).
In order to do this, I need to access the recordset that was used to create the report. As I understand it, I cannot do this with a report (no equivalent of the recordsetclone property or anything similar). What I have to do is create the recordset that was used to create the report in the first place. No problem right?
set mydb=dbengine(0)(0)
set rs1=mydb.openrecordset("queEEGBilling")
However, here I get the infamous error 3061. Too Few Parameters. Expected 1.
I have googled this up and down, and it seems to be related to my query being too complex. However, I did not write this query by hand, it came from Access2002. And this query worked fine to generate my report. So, why does it crash now??
Any help would be greatly appreciated.
Cheers
Gyl
View 1 Replies
View Related
Oct 22, 2007
I tried to get help elsewhere with this but it didn't quite work out, so I thought I'd pick a few other brains. So here's the problem from the beginning.
I made a table with three fields:
Field Name----Data Type
Category------Text
Item----------Text
Cost----------Number
I set up a form with two combo boxes and two text boxes. I want to pick an Item from the combo box, and have the Cost appear in the corresponding text box. I set up the combo box to show each field when I click on the arrow.
I was given the following code to put in the After Update section under the Event tab for the combo box:
Private Sub Combo8_AfterUpdate()
Me.Text2 = Me.Combo8.Column(2)
End Sub
That works. I pick an item from the combo box, and its value appears in the text box next to it. Ultimately, I want to edit the value in the text box and have it update the table. I was given the following code for the text box:
Private Sub MyTextbox_AfterUpdate()
Dim strSQL As String
strSQL = "UPDATE MyTable " & _
"SET Myfield = " & Me.MyTextbox & _
" WHERE Id = " & Me.MyCombo
CurrentDb.Execute strSQL, dbFailOnError
End Sub
So far, that hasn't worked. I believe I've made the correct substitutions:
Private Sub Text2_AfterUpdate()
Dim strSQL As String
strSQL = "UPDATE [Primary Table] " & _
"SET Cost = " & Me.Text2 & _
" WHERE Id = " & Me.Combo8
CurrentDb.Execute strSQL, dbFailOnError
End Sub
When I type a different value into the text box and hit enter, I get the following error:
Run-time error '3061':
Too few parameters. Expected 2.
I was given a different line of code in the event that I'm "trying to pass text":
" WHERE Id = '" & Me.Combo8 & "'"
When I use that, the error is the same except it says:
Too few parameters. Expected 1.
Does anyone know the correct code?
View 2 Replies
View Related
Aug 5, 2005
SQL Issue ...
ERROR: Runtime error 3061 - Too few parameters. Expected 1.
------------------------------------------------------------------------
Not sure how to work in the '* ROLL *' into this SQL statement. The query statement works fine ... I have tried different quotation methods ( Not Like " & " '
* ROLL * & ' " & " ) AND .... )
sql = "SELECT DISTINCTROW Sum(CDbl([Scrap Factor])) AS SumOFScrap FROM [RT: Signpro1: Costs] LEFT JOIN [DT: InventoryExtend] ON [RT: Signpro1: Costs].[Part Number] = [DT: InventoryExtend].[Part#] GROUP BY [DT: InventoryExtend].CategoryID, [DT: InventoryExtend].Description, [forms]![signpro sign estima parameters]![combo14] HAVING ((([DT: InventoryExtend].CategoryID)=30) AND (([DT: InventoryExtend].Description) Not Like '* ROLL *') AND (([forms]![signpro sign estima parameters]![combo14])=1));"
ANY HELP WOULD BE APPRECIATED ...
Cheers,
QTNM
View 14 Replies
View Related
Oct 27, 2005
Hi there....Im busy tonight trying to get a couple of things working correctly.
I have an UPDATE string that I am trying to get working but I am getting a runtime error 3061 saying 'To few parameters Expected 1'
I have tried the same query using the query builder and it works ok...when I try it in VBA it doesn't work.
This is my code
Dim SQLUpdate As String
Dim SQLWhere As String
Dim strComplete As String
SQLUpdate = " UPDATE tblPersonalInformation SET tblPersonalInformation.DateModified = Now() "
SQLWhere = " WHERE tblPersonalInformation.PersonalID = [Forms]![frmMain]![txtCandidateNumberReadOnly]"
strComplete = SQLUpdate & SQLWhere
Debug.Print strComplete
CurrentDb.Execute strComplete
End Sub
Can anyone see what I am missing or I am doing wrong?
Thanks evryone for your help.
View 5 Replies
View Related
Jun 11, 2013
Here's my Goal: To open a saved query that has a parameter, setting that parameter via a VBA sub.
Here's my Problem: I was getting various errors, but after debugging my program a bit, it comes down to a "Data Type Conversion Error"
Here's my Code:
Set db = CurrentDb
Set qd = db.QueryDefs("qryMY_DATA")
qd.Parameters(0) = Me.txt_ReferenceID
Set rs = qd.OpenRecordset("qryMY_DATA", dbDynaset)
Code:
'*** Database Variables
Dim db As DAO.Database, rs As DAO.Recordset, gq As DAO.QueryDef, prm As DAO.Recordset
I've been all over the forums and tried several different approaches, all to no avail. The Query runs fine in the QDT, but kicks back an error when I try to run it from my sub.
View 10 Replies
View Related
Aug 2, 2012
I'm trying to open a recordset in vba and I'm getting the 3061 runtime error,Expected 1.
I'm trying to open a recordset with a query that uses a reference to a form control.
Code:
searchtable1 = "qInVisio_RSV"
Set rs = db.OpenRecordset(searchtable1, dbOpenDynaset, dbSeeChanges)
This is the sql of the query:
The highlighted parted is the form referance ( I know it's obvious, just for easier spotting )
Code:
SELECT dbo_FOLIO.FOLIOID, dbo_FOLIO.KIND, dbo_FOLIO.RSVID, dbo_FOLIO.CHKIDATE, dbo_RLIST.ROOMID, dbo_ROOM.ROOMNO, dbo_AGN.LINAPRG
FROM (dbo_ROOM INNER JOIN (dbo_FOLIO INNER JOIN dbo_RLIST ON dbo_FOLIO.RSVID = dbo_RLIST.RSVID) ON dbo_ROOM.ROOMID = dbo_RLIST.ROOMID) LEFT JOIN dbo_AGN ON dbo_FOLIO.AGNID = dbo_AGN.AGNID
WHERE (((dbo_FOLIO.KIND)=101) AND ((dbo_FOLIO.CHKIDATE)>=[Forms]![frmCleaningPlan]![DTPicker]));
also as you can see it's a datepicker control, so the value is a date...
View 2 Replies
View Related
Aug 12, 2015
I keeping getting the error "Invalid use of Null" when i call my email function using optional parameters.
Code:
Email Me.ProjectID.Column(1), _
Me.ProjectAddress, _
Me.TaskDescID.Column(1), _
Me.TaskDescExt, _
strStatus, _
Me.TaskStatusID.Column(1), _
[Code] .....
View 4 Replies
View Related
Feb 11, 2008
Hi All,I am getting problem "Error: too few parameters. Expected 1" when following Query is executed to updated a Flag Value in a table on Click event of a Submit button. CurrentDb.Execute "UPDATE Scheduled_Appointment SET Is_Taken = 1 WHERE Scheduled_Appointment_ID LIKE Me.Sch_P_ID"Where:Table: Scheduled_AppointmentColumn: Scheduled_Appointment_ID [Primary Key]Column: Is_Taken [ColumnType = Number ]Text Field: Me.Sch_P_ID [contains the Scheduled_Appointment_ID value for the selected Record on the Form]Thanks in Advance.
View 2 Replies
View Related
Sep 9, 2005
I could use some help. I am not a programmer, I am helping someone out.
We have an access database that is accessed using asp webpages. When trying to add students to the database we get the following error
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. line 51
Below is the code on the page.
If ((request("REQUEST_METHOD") = "POST") and ((request("CONTENT_LENGTH") > 0) and (request("CONTENT_LENGTH") < 14500))) then %>
<%
LastName = request("Last_Name")
FirstName = Request("First_Name")
MiddleName = request("Middle_Name")
Student = request("Student_Number")
WEng316 = request("WEng316")
WChEn475 = request("WChEn475")
WChEn477 = request("WChEn477")
OChEn391 = request("OChEn391")
OChEn451 = request("OChEn451")
TChEn475 = request("TChEn475")
TChEn477 = request("TChEn477")
TChEn451 = request("TChEn451")
YearOfTest = request("YearOf_Test")
sValue = request("submitValue")
strProvider="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("iisadmin") & "websitelevel3_questions.mdb;"
set cm = Server.CreateObject("ADODB.Command")
set objConn = server.createobject("ADODB.Connection")
objConn.Open strProvider
cm.ActiveConnection = objConn
insertString = "INSERT INTO Students(LastName,FirstName,MiddleName,StudentNumb er,YearOfTest,Writ316,Writ475,Writ477,Oral391,Oral 451,TW451,TW475,TW477) "
insertString = insertString & "VALUES ('"&LastName&"','"&FirstName&"','"&MiddleName&"',"&Student&","&YearOfTest&","&WEng316
insertString = insertString & ","&WChEn475&","&WChEn477&","&OChEn391&","&OChEn451&","&TChEn451&","&TChEn475&","&TChEn477&")"
cm.CommandText = insertString
'cm.CommandText="INSERT INTO Students(LastName,FirstName,MiddleName,StudentNumb er) VALUES (?, ?, ?, ?)"
'Set objParam=cm.CreateParameter(, 200, , 255, LastName)
'cm.Parameters.Append objParam
'Set objParam=cm.CreateParameter(, 200, , 255, FirstName)
'cm.Parameters.Append objParam
'Set objParam=cm.CreateParameter(, 201, , 255, MiddleName)
'cm.Parameters.Append objParam
'Set objParam=cm.CreateParameter(, 201, , 255, Student)
'cm.Parameters.Append objParam
cm.Execute
%>
<% If (sValue = "1") then
Response.Redirect("viewStudents.asp")
Else %>
<HTML>
<HEAD>
<TITLE>Add Student
</TITLE>
<!--#include virtual ="/byu/admin/adminInclude.inc"-->
<%
call stylesheet
%>
<script language=javascript>
<!--
function form_submit(where)
{
if (where=="return")
{
document.form.submitValue.value=1;
} else {
document.form.submitValue.value=2;
}
var err = 0;
if (document.form.Student_Number.value == "")
{
err = 1;
alert("Please enter student's number.");
} else if (document.form.First_Name.value == "") {
err = 1;
alert("Please enter student's first name.");
} else if (document.form.Last_Name.value == "") {
err = 1;
alert("Please enter student's last name.");
}
if (document.form.WEng316.value == "")
document.form.WEng316.value = "0";
if (document.form.WChEn475.value == "")
document.form.WChEn475.value = "0";
if (document.form.WChEn477.value == "")
document.form.WChEn477.value = "0";
if (document.form.OChEn391.value == "")
document.form.OChEn391.value = "0";
if (document.form.OChEn451.value == "")
document.form.OChEn451.value = "0";
if (document.form.TChEn451.value == "")
document.form.TChEn451.value = "0";
if (document.form.TChEn475.value == "")
document.form.TChEn475.value = "0";
if (document.form.TChEn477.value == "")
document.form.TChEn477.value = "0";
if (document.form.YearOf_Test.value == "")
document.form.YearOf_Test.value = "0";
if (err == 0)
{
document.form.submit();
}
}
function loadMe()
{
alert("Student added successfully.");
}
-->
</script>
</HEAD>
<BODY bottomMargin=15 leftMargin=15 topMargin=15 rightMargin=15 marginwidth="0" marginheight="0" onLoad="loadMe();">
<%
call header
%>
<FORM NAME="form" METHOD=POST ACTION="addStudents.asp">
<INPUT TYPE=hidden name=submitValue >
<table cellSpacing=0 cellPadding=0 BORDER=0 WIDTH="95%" align=center>
<tr>
<td colspan=3 > </td>
</tr>
<tr>
<TD> </TD>
<td colspan=0 ><span class=admintext>First name:</span></td>
<TD><INPUT TYPE='text' NAME='First_Name' Size='25' MAXLENGTH='254'></TD>
</tr>
<tr>
<TD> </TD>
<td ><span class=admintext>Middle name:</span></td>
<TD><INPUT TYPE='text' NAME='Middle_Name' Size='25' MAXLENGTH='254'></TD>
</tr>
<tr>
<TD> </TD>
<td colspan=0 ><span class=admintext>Last name:</span></td>
<TD><INPUT TYPE='text' NAME='Last_Name' Size='25' MAXLENGTH='254'></TD>
</tr>
<tr>
<TD> </TD>
<td colspan=0 ><span class=admintext>Student number:</span></td>
<TD><INPUT TYPE='text' NAME='Student_Number' Size='10' MAXLENGTH='254'></TD>
</tr>
<tr>
<TD> </TD>
<td colspan=0 ><span class=admintext>Written Communication:</span></td>
<TD><span class=admintext>Engl 316 </span>
<INPUT TYPE='text' NAME='WEng316' Size='5' MAXLENGTH='3'>
<span class=admintext>ChEn 475 </span>
<INPUT TYPE='text' NAME='WChEn475' Size='5' MAXLENGTH='3'>
<span class=admintext>ChEn 477 </span>
<INPUT TYPE='text' NAME='WChEn477' Size='5' MAXLENGTH='3'>
</TD>
</tr>
<tr>
<TD> </TD>
<td colspan=0 ><span class=admintext>Oral communication:</span></td>
<TD><span class=admintext>ChEn 391 </span>
<INPUT TYPE='text' NAME='OChEn391' Size='5' MAXLENGTH='3'>
<span class=admintext>ChEn 451 </span>
<INPUT TYPE='text' NAME='OChEn451' Size='5' MAXLENGTH='3'>
</TD>
</tr>
<tr>
<TD> </TD>
<td colspan=0 ><span class=admintext>Teamwork:</span></td>
<TD><span class=admintext>ChEn 451 </span>
<INPUT TYPE='text' NAME='TChEn451' Size='5' MAXLENGTH='3'>
<span class=admintext>ChEn 475 </span>
<INPUT TYPE='text' NAME='TChEn475' Size='5' MAXLENGTH='3'>
<span class=admintext>ChEn 477 </span>
<INPUT TYPE='text' NAME='TChEn477' Size='5' MAXLENGTH='3'>
</TD>
</tr>
<tr>
<TD> </TD>
<td colspan=0 ><span class=admintext>Year of test:</span></td>
<TD><INPUT TYPE='text' NAME='YearOf_Test' Size='10' MAXLENGTH='254'> <span class=admintext>(Example:<b>Y2002-03</b>)</span></TD>
</tr>
<tr>
<td colspan=3 > </td>
</tr>
<tr>
<TD> </TD>
<td colspan=2 >
<table cellSpacing=2 cellPadding=0 BORDER=0 align=left >
<tr><td>
<table cellSpacing=2 cellPadding=0 BORDER=1 align=left bgcolor=#003366>
<tr><td bgcolor=#cccccc> <a href="javascript:form_submit('return');" class=adminlink><b>Save and Return</b></a>
</td></tr>
</table>
</td>
<td> </td>
<td>
<table cellSpacing=2 cellPadding=0 BORDER=1 align=left bgcolor=#003366>
<tr><td bgcolor=#cccccc> <a href="javascript:form_submit('stay');" class=adminlink><b>Save and Add another</b></a>
</td></tr>
</table>
</td></tr>
</table>
</td>
</tr>
</table>
</FORM>
<% End If %>
<% Else %>
<HTML>
<HEAD>
<TITLE>Add Student
</TITLE>
<!--#include virtual ="/byu/admin/adminInclude.inc"-->
<%
call stylesheet
%>
<script language=javascript>
<!--
function form_submit(where)
{
if (where=="return")
{
document.form.submitValue.value=1;
} else {
document.form.submitValue.value=2;
}
var err = 0;
if (document.form.Student_Number.value == "")
{
err = 1;
alert("Please enter student's number.");
} else if (document.form.First_Name.value == "") {
err = 1;
alert("Please enter student's first name.");
} else if (document.form.Last_Name.value == "") {
err = 1;
alert("Please enter student's last name.");
}
if (document.form.WEng316.value == "")
document.form.WEng316.value = "0";
if (document.form.WChEn475.value == "")
document.form.WChEn475.value = "0";
if (document.form.WChEn477.value == "")
document.form.WChEn477.value = "0";
if (document.form.OChEn391.value == "")
document.form.OChEn391.value = "0";
if (document.form.OChEn451.value == "")
document.form.OChEn451.value = "0";
if (document.form.TChEn451.value == "")
document.form.TChEn451.value = "0";
if (document.form.TChEn475.value == "")
document.form.TChEn475.value = "0";
if (document.form.TChEn477.value == "")
document.form.TChEn477.value = "0";
if (err == 0)
{
document.form.submit();
}
}
-->
</script>
</HEAD>
<BODY bottomMargin=15 leftMargin=15 topMargin=15 rightMargin=15 marginwidth="0" marginheight="0">
<%
call header
%>
please help ASAP
thank you
View 1 Replies
View Related
Sep 29, 2015
I have the error 80040e10-No value given for one or more required parameter inside a SQL string and I know that the problem is some/one of my variables passed, however I cannot found the mistake. See down here my code. I got experience in VBA but no much in ACCESS so the query have some problems.
I got the following parameters used inside of the string (I can see before open the recordset that all of them have valid values);
TotalGj is a number result of a dsumTemp1 is a textMketer is a text
My code is down here
Sub Enterdata()
Dim Mketer As String, MonthBR As String
Dim HECAmount As Currency
Dim RsCustomers As ADODB.Recordset, RsFfeesMonth As ADODB.Recordset
Dim Cnx As ADODB.Connection
[Code] .....
View 5 Replies
View Related
Oct 17, 2006
I am trying to pass parameters to my qury thru my combo selection. I keep getting this error "Data type mismatch criteria expression", does anyone have an idea why?
WHERE (((fShiftWorked([tblTimeLog].[timeStart])=[Forms]![frmOperatorWorkDone]![cboShift] Or IsNull([Forms]![frmOperatorWorkDone]![cboShift]))=True));
I have spent so much time onthis already and i am sick of it :mad:
Attached is my db. Please help me out here.
View 2 Replies
View Related
Jul 14, 2014
I'm populating my listbox from access but it doesn't like my SQL statement, where am I going wrong
sSQL = "SELECT * from Process where ParentName = '[cboCategory]'"
Process is a table and cboCategory is the excel form control.
The error is "No given value for one or more required parameters.
View 3 Replies
View Related
Jan 22, 2015
This is my first time writing a pass through query pinging sql tables using an input parameter from a form. I have gotten as far as executing the query but I can't seem to display the result to ensure it's pulling the right records. I also want to be able to append the records to a table. Below is the code I have written so far:
Sub GETRT()
Code:
Dim db As DAO.Database
Dim QDF As QueryDef
Dim STRSQL As String
Dim RS As Recordset
STRSQL = "SELECT * FROM LAB_MESR.ODM_RT_DAYS" & _
"WHERE LOCATION_ID=" & [Forms]![PARMS]![STR_NBR]
Set db = CurrentDb
Set QDF = db.QueryDefs("001:GET_LT")
QDF.SQL = STRSQL
End Sub
View 5 Replies
View Related
Aug 18, 2015
I have a sample database (attached) where I have a form called frmVoteHeadsOne. The voteheads that I have are swimming (Swim) and transport (Trans), which both appear for data in a table. On the form, from the combo list, I would wish that if I select swimming, for example, only Mark Tyler's name is returned since he has paid 2000; if I select Transport from the same list, only John clement's name is returned.
My purpose for doing this is because in the actual database, I have 21 different voteheads which I would like to get different results from based on what the user selects from the combo list.
View 8 Replies
View Related
Dec 10, 2014
I am trying to dynamically change the IN sql from within VBA using parameters. for some reason i have no luck, no errors shows up, but it's actually not picking up the criteria.
Code:
THE SQL IN STATEMENT
In (select RemID from [ReminderAssignees] Where RemDate between [Date1] and [Date2] And [sDismiss] )));
Code:
THE VBA CODE
qdf.Parameters("date1") = Date1
qdf.Parameters("date2") = Date2
Select Case iDismissed
Case 0, 1
qdf.Parameters("sDismiss") = "1=1"
Case 2
qdf.Parameters("sDismiss") = "(not isdate(Dismiss) or Dismiss > #" & Now & "#)"
Case 3
qdf.Parameters("sDismiss") = " isdate(Dismiss) and Dismiss < #" & Now & "#"
End Select
qdf.Execute
View 6 Replies
View Related
Jul 31, 2015
How to set parameters for the date being last monday to last sunday
So
Paramaters = Date
Then I need
ParamatersWeek = the last monday to the last sunday ...
View 2 Replies
View Related
Feb 12, 2014
Table: DailyExport
Field: FailureGrouping (actually is offices)
I want to export all the fields from DailyExport each of our 9 offices to Excel, whetjer or not they have date in the DailyExport table. So if not, the exported workbook would only have columns headings.
I need to loop through the nine offices and export each office report to Excel.
Dim StrQry As String
Dim strfullpath As String
Dim SOffice as String
strSQL = "SELECT * FROM DailyExport WHERE FailureGrouping = " & SOffice
strfullpath = "Y:" & SOffice &" "& Format(Date,"mm-dd-yy") & "_Failures.xlsx"
DoCmd.TransferSpreadsheet acExport, , FailureGrouping, strfullpath, False
View 1 Replies
View Related