Hello
I have the following code (see below). PhoneSearch is a stored procedure on the SQL server. I'm calling the procedure from Access vba and storing the results in an access form
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.ConnectionString = "Driver={SQL Server};Server=LAPTOP-A35N8041;Database=PhoneDB;Trusted_Connection=yes"
cnn.Open
Set rs = New ADODB.Recordset
Set rs = cnn.Execute("Exec dbo.PhoneSearch " & [DeviceNumber])
The code works well until there is a space in DeviceNumber. So, ATN102 works fine, but ATN 102 causes an error. Is there a way to get this working with a space between ATN and 102? I have quite a lot of other data in the table like this. It would take too long to remove the spaces. The procedure when executed in SQL server works fine
Regards
Chris