run time error '424: object required

tiger123

New Member
Joined
Jun 24, 2014
Messages
37
i am getting an error in my insert query please help me


Rich (BB code):
Private Sub cmdbt1_Click()

Dim EmployeeName, SystemName, LoginDate, LoginTime, TeamLeadBy, ProjectName, AllocatedWork

'Set txtSampleTextBox = Controls.Add("Forms.TextBox.1", "txtSampleTB")
'Set rst = CreateObject("adodb.recordset")

    server_name = "192.168.1.200"
    Database_Name = "empdetails" ' Enter your database name here
    User_id = "root" ' enter your user ID here
    Password = "bmx1" ' Enter your password here
    source1 = "emp"
   
    Set conn = New ADODB.Connection
   ' Set rst = New ADODB.Recordset

conn.ConnectionString = "DRIVER={MySQL ODBC 5.2 unicode Driver};SERVER=" & server_name & ";UID=" & User_id & _
";PWD=" & Password & ";DATABASE=" & Database_Name & "; Source=" & source1 & ";"
conn.Open
Dim c As ADODB.Connection
Dim r As ADODB.Recordset

Set c = New ADODB.Connection

Dim rw As Integer

c.Open "DSN=emp"

Sql = "Insert into userinfo (employeename,systemname,logindate,logintime,team leadby,projectname,allocatedwork) Values ('" & _
EmployeeName.Value & "', '" &   SystemName.Value & "','& logindate.value & " ','" & logintime.value & "','" & team leadby.value & _
"','" & projectname.value & "','" & allocatedwork.value & "')"


Set r = c.Execute(Sql)
c.Close
     'conn.Close

     Unload Me
    MsgBox "Database Updated!", vbOKOnly, "Update!"
End Sub


employeename(lbl1)systemname(Label1)logindate(lbl3)logintime(lb5)teamleadby(txtbx)projectname(txtbx)allocatedwork(txtbx)

i have used in userfrom

i am trying to insert into the mysql database

please help me out
 
Last edited by a moderator:

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Cross-posted here. The answer is the same as I gave you there - you do not have controls with those names.
 
Upvote 0

Forum statistics

Threads
1,215,055
Messages
6,122,902
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top