473,383 Members | 1,798 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,383 software developers and data experts.

run-time error '-2147217904 (80040e10)': No value given for one or more parameters

1
Hi,

I orignaly posted this with the error above, however I am still trying to solve it on my own, and found that some of my syntax in the query was not correct and I corrected it. But i am still getting an error although a different one = run-time error '-2147217913 (80040e07)': data type mismatch in criteria expression.

I'm creating a user form in excel to pull through/update/insert info into my access db. I have created a user form to login. I had many issues in getting the login user form to show, but I finally managed. However, now when I type in the username and pw and click on the btnLogin, it gives me the error above, and when I click debug, it brings me into the OpenRec sub.

Here is the code I use to connect to the db, and the OpenRec sub I mentioned which it brings me to when I click debug. I've bolded, underlined and italiced where it breaks at.
Expand|Select|Wrap|Line Numbers
  1. ublic Sub ConnectDB(Optional strConnString As String, Optional intConnectID As Integer) '(Optional DBPath As String, Optional ConnString As String)
  2.     Dim strConn, DBPath, ConnString As String
  3.  
  4.     'Define Connection
  5.     Select Case shtSettings.Range("setDBType").Value
  6.         Case "Access"
  7.             If InStr(1, shtSettings.Range("setSQLServer").Value, ":") <> 0 Then
  8.             'If FileOrDirExists(GetRootFolder() & "\system32\sqlncli.dll") = False Then
  9.                 strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & shtSettings.Range("setSQLServer").Rows(1) & DBPath & ";Persist Security Info=False"
  10.             Else
  11.                 If CStr(shtSettings.Range("setSQLUsername").Value) = "" And CStr(shtSettings.Range("setSQLPassword").Value) = "" Then
  12.                     strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ("C:\Documents and Settings\User\Desktop\Eitans Stuff\Docs\OJE.mdb")
  13.                 Else
  14.                     strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & shtSettings.Range("setSQLServer").Rows(1) & ";Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";Persist Security Info=False"
  15.                 End If
  16.             End If
  17.         Case "MSSQL"
  18.             If FileOrDirExists(GetRootFolder() & "\system32\sqlncli.dll") = False Then
  19.                 strConn = "Driver=SQL Server;Server=" & shtSettings.Range("setSQLServer").Rows(1) & ";user id=" & shtSettings.Range("setSQLUsername").Value & ";password=" & shtSettings.Range("setSQLPassword").Value & ";Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";"
  20.             Else
  21.                 If CStr(shtSettings.Range("setSQLUsername").Value) = "" And CStr(shtSettings.Range("setSQLPassword").Value) = "" Then
  22.                     strConn = "Provider=SQLNCLI;Server=" & shtSettings.Range("setSQLServer").Rows(1) & ";Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";Trusted_Connection=yes;"
  23.                 Else
  24.                     strConn = "Provider=SQLNCLI;Server=" & shtSettings.Range("setSQLServer").Rows(1) & ";Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";Uid=" & shtSettings.Range("setSQLUsername").Value & "; Pwd=" & shtSettings.Range("setSQLPassword").Value & ";"
  25.                 End If
  26.             End If
  27.         Case "MSSQL2000"
  28.             If FileOrDirExists(GetRootFolder() & "\system32\sqlncli.dll") = False Then
  29.                 strConn = "Driver=SQL Server;Server=" & shtSettings.Range("setSQLServer").Rows(1) & ";user id=" & shtSettings.Range("setSQLUsername").Value & ";password=" & shtSettings.Range("setSQLPassword").Value & ";Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";"
  30.             Else
  31.                 If CStr(shtSettings.Range("setSQLUsername").Value) = "" And CStr(shtSettings.Range("setSQLPassword").Value) = "" Then
  32.                     strConn = "Provider=SQLNCLI;Server=" & shtSettings.Range("setSQLServer").Rows(1) & ";Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";Trusted_Connection=yes;"
  33.                 Else
  34.                     strConn = "Provider=SQLNCLI;Server=" & shtSettings.Range("setSQLServer").Rows(1) & ";Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";Uid=" & shtSettings.Range("setSQLUsername").Value & "; Pwd=" & shtSettings.Range("setSQLPassword").Value & ";"
  35.                 End If
  36.             End If
  37.         Case "MySQL"
  38.             If InStr(1, shtSettings.Range("setSQLServer").Value, ":") <> 0 Then
  39.                 strConn = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=" & Left(shtSettings.Range("setSQLServer").Rows(1), InStr(1, shtSettings.Range("setSQLServer").Value, ":") - 1) & ";DATABASE=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";USER=" & shtSettings.Range("setSQLUsername").Value & ";PASSWORD=" & shtSettings.Range("setSQLPassword").Value & ";PORT=" & Replace(shtSettings.Range("setSQLServer").Rows(1), Left(shtSettings.Range("setSQLServer").Rows(1), InStr(1, shtSettings.Range("setSQLServer").Value, ":")), "") & ";"
  40.             Else
  41.                 strConn = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=" & shtSettings.Range("setSQLServer").Rows(1) & ";DATABASE=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";USER=" & shtSettings.Range("setSQLUsername").Value & ";PASSWORD=" & shtSettings.Range("setSQLPassword").Value & ";"
  42.             End If
  43.     End Select
  44.     If GetSetting("ReimbursementTool", "Office", "OfficePC") = "1" Then
  45.         'strConn = "Driver=SQL Server;Server=SSISQL1\WEXCEL;user id=sa;password=hawkey;Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";"
  46.         'strConn = "Driver=SQL Server;Server=EITAN\SQLEXPRESS;user id=;password=;Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";"
  47.         'strConn = "Driver=SQL Server;Server=wxlsvr1;user id=sa;password=hawkey;Database=" & shtSettings.Range("setSQLDatabase").Rows(1) & ";"
  48.     End If
  49.     If strConnString <> "" Then strConn = strConnString
  50.  
  51.     'Instantiate Connection Object
  52.     Set cnnXLW = New ADODB.Connection
  53.  
  54.     'Specify read and write for the Access database
  55.     cnnXLW.Mode = adModeReadWrite
  56.  
  57.     'Open connection object
  58.     On Error GoTo DBError
  59.     cnnXLW.Open strConn
  60.     cnnXLW.CommandTimeout = 0
  61.  
  62.     Set rsXLW = New ADODB.Recordset
  63.     Set rsXLW_1 = New ADODB.Recordset
  64.     Set rsXLW_2 = New ADODB.Recordset
  65.     Set rsXLW_3 = New ADODB.Recordset
  66.     Set cmdXLW = New ADODB.Command
  67.     cmdXLW.ActiveConnection = cnnXLW
  68.     cmdXLW.CommandTimeout = 0
  69.  
  70.     Connected = True
  71.     'Application.Calculation = xlCalculationManual
  72.  
  73. ErrCont:
  74. Exit Sub
  75.  
  76. DBError:
  77. MsgBox "Database Connection Error: " & Err.Description
  78. Connected = False
  79. Resume ErrCont
  80.  
  81. End Sub
Expand|Select|Wrap|Line Numbers
  1. Public Sub OpenRec(SQL As String, Optional ByVal intCount As Integer)
  2.  
  3.     Select Case intCount
  4.         Case 0
  5.             If rsXLW.State = 1 Then CloseRec
  6.             If rsXLW.State = 0 Then
  7.              rsXLW.CursorLocation = adUseClient
  8.              rsXLW.Open SQL, cnnXLW, adOpenStatic, adLockOptimistic
  9.              RecOpen = True
  10.             End If
  11.  
  12.         Case 1
  13.             If rsXLW_1.State = 1 Then CloseRec (1)
  14.             If rsXLW_1.State = 0 Then
  15.              rsXLW_1.CursorLocation = adUseClient
  16.              rsXLW_1.Open SQL, cnnXLW, adOpenStatic, adLockOptimistic
  17.              RecOpen = True
  18.             End If
  19.  
  20.         Case 2
  21.             If rsXLW_2.State = 1 Then CloseRec (2)
  22.             If rsXLW_2.State = 0 Then
  23.              rsXLW_2.CursorLocation = adUseClient
  24.              rsXLW_2.Open SQL, cnnXLW, adOpenStatic, adLockOptimistic
  25.              RecOpen = True
  26.             End If
  27.  
  28.         Case 3
  29.             If rsXLW_3.State = 1 Then CloseRec (3)
  30.             If rsXLW_3.State = 0 Then
  31.              rsXLW_3.CursorLocation = adUseClient
  32.              rsXLW_3.Open SQL, cnnXLW, adOpenStatic, adLockOptimistic
  33.              RecOpen = True
  34.             End If
  35.  
  36.     End Select
  37.  
  38.     Exit Sub
  39.  
  40.  
  41.  
  42. End Sub 
Apr 21 '10 #1
1 4584
patjones
931 Expert 512MB
Where is the call to OpenRec? I'd like to see explicitly what is being passed in to it. And if you could post the code for the btnLogin On Click event that would be helpful.

Pat
Apr 22 '10 #2

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

Similar topics

44
by: MadCrazyNewbie | last post by:
Hey Group, I keep getting a error saying "No Value Given For One Or More Parameters". Unfortunatly I don`t know where this error is coming from:(. Can I run through my code line by line, so I...
1
by: Akinyemi | last post by:
I created a Database which I named "Address". I went through the Control Panel and created a DSN to enable me connect to the Database through ODBC. I then created a Form with the same fields as...
2
by: katrinkerber | last post by:
Hello, I need help to solve a runtime error that keeps reocurring every time I try to convert an Excel file into an Acess File. I have looked through many forums trying to find help, but I have...
2
by: 101 | last post by:
Tell me what's wrong in the statement recordset.open "select name from tablename where birthdate=4/3/2007",con runtime error as :no value is given to 1 or more parameters required.
15
by: Dave | last post by:
I am getting the error above intermittantly with an ASP 3.0 page using an MS Access 2003 database. I have searched Google extensively and found the following possible causes for this error: A...
0
by: Gwen Crutcher | last post by:
I keep getting the error "No value given for one or more required parameters", but not sure why. Can anyone please look at my code snipet and see if you see any reason why I could be getting this...
2
by: amolbehl | last post by:
I use VB6.0 and when I execute the code I have given below, I get runtime Error 1004 - Specified value is out of range. Set oXL = CreateObject("Excel.Application") oXL.Visible = True ...
2
by: VaTravo | last post by:
I am using access database as my back-end and Visual basics 6.0 as my front-end.my application must generate dynamic reports and i have tried using the article by Farhana but the during execution...
0
by: vasavasnehal | last post by:
Hi all..! Give me information and solution for this error Runtime error: 2147217904(80040e10) No value given for one ot more equired parameters. My project code: Private Sub Form_Load()
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.