timhans
Programmer
- Jun 24, 2009
- 75
My apologies for posting so much, but I am making a big push to get this stuff and I am finding it confusing. So I can know execute a update and insert sql statement, but not a select statement that parse's my table
I don't get a error it just is completely ignored, the sql statement runs in the GUI and as DoCmd.Run SQL, but here it is just ignored!. If I run pSQL as a stored procedure and make table it works but takes about 2 minutes for the table to show up. I am befuddled by all of this, if you can help me understand what's going on I would appreciate it, thanks
Here is my code ( in the parse statement the ',' is calling out the delimiter)
Dim Cmd As ADODB.Command
Dim pSQL As String
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = CurrentProject.Connection
pSQL = "SELECT tblCustomersFinished.CustomerID, tblCustomersFinished.FirstName, tblCustomersFinished.LastName, tblCustomersFinished.Address, tblCustomersFinished.Apt, tblCustomersFinished.City, tblCustomersFinished.State, tblCustomersFinished.Zip, tblCustomersFinished.Phone, tblCustomersFinished.Contact, tblCustomersFinished.Physician, tblCustomersFinished.DOB, tblCustomersFinished.Model, tblCustomersFinished.SerialNumber, tblCustomersFinished.Insurance, Parse([Diagnosis],1,',') AS Diagnosis1, Parse([Diagnosis],2,',') AS Diagnosis2, Parse([Diagnosis],3,',') AS Diagnosis3, Parse([Diagnosis],4,',') AS Diagnosis4 FROM tblCustomersFinished"
Cmd.CommandText = pSQL
Cmd.CommandType = adCmdText
Cmd.Execute RecordsAffected:=recs, options:=adExecuteNoRecords
Set Cmd = Nothing
End Sub
I don't get a error it just is completely ignored, the sql statement runs in the GUI and as DoCmd.Run SQL, but here it is just ignored!. If I run pSQL as a stored procedure and make table it works but takes about 2 minutes for the table to show up. I am befuddled by all of this, if you can help me understand what's going on I would appreciate it, thanks
Here is my code ( in the parse statement the ',' is calling out the delimiter)
Dim Cmd As ADODB.Command
Dim pSQL As String
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = CurrentProject.Connection
pSQL = "SELECT tblCustomersFinished.CustomerID, tblCustomersFinished.FirstName, tblCustomersFinished.LastName, tblCustomersFinished.Address, tblCustomersFinished.Apt, tblCustomersFinished.City, tblCustomersFinished.State, tblCustomersFinished.Zip, tblCustomersFinished.Phone, tblCustomersFinished.Contact, tblCustomersFinished.Physician, tblCustomersFinished.DOB, tblCustomersFinished.Model, tblCustomersFinished.SerialNumber, tblCustomersFinished.Insurance, Parse([Diagnosis],1,',') AS Diagnosis1, Parse([Diagnosis],2,',') AS Diagnosis2, Parse([Diagnosis],3,',') AS Diagnosis3, Parse([Diagnosis],4,',') AS Diagnosis4 FROM tblCustomersFinished"
Cmd.CommandText = pSQL
Cmd.CommandType = adCmdText
Cmd.Execute RecordsAffected:=recs, options:=adExecuteNoRecords
Set Cmd = Nothing
End Sub