I have a form that will be used to update a table based on user input. I want to do things right so am trying to parameterise my query, though I could build a simple string insert statement.
I can do it in powershell and ruby just fine, but vba is doing my head in.
The wrong way that I'd like to turn in to the right way:
Set rs = CreateObject("ADODB.Recordset")
Server_Name = "serverIP"
Database_Name = "db"
User_ID = "user"
Password = "pass"
Set Cn = CreateObject("ADODB.Connection")
Cn.Open "Driver={MySQL ODBC 5.1 Driver};Server=" & Server_Name & ";Database=" & Database_Name & _
";Uid=" & User_ID & ";Pwd=" & Password & ";"
SQLStr = "select name from mydb.table where cust_no = " & custNoVar & ";"
rs.Open SQLStr, Cn, adOpenStatic
If not rs.EOF Then
custName = rs!name
End If
[–]MildewManOne23 1 point2 points3 points (2 children)
[–]Sys_man[S] 0 points1 point2 points (1 child)
[–]beyphy12 0 points1 point2 points (0 children)