Retrieve Value From Mssql Database Based On Commander Field Follow
I have the following scenario:
Printing labels using Commander. One of the fields sent to Commander is the item number. I have a field on my label that should display the item description. The item description is held in a MSSQL database. I need to take the item number from the Commander input and use that value in my query to the MSSQL database.
My problem is that I am unsure how to reference the item number field from the commander database in a query to my MSSQL database. Here's what I have so far:
Set oCon = CreateObject("ADODB.Connection") Set oRS = CreateObject("ADODB.RecordSet") oCon.Open "Provider=SQLOLEDB.1;Password=xxxxx;Persist Security Info=true;User ID=xxxxx;Initial Catalog=MyDB;Data Source=MyServer" oRS.open "SELECT Description FROM dbo.items where itemnumber = LBITEM", oCon, 3, 4 value = oRs.Fields("Description") set oRS = nothing set oCon = nothing
LBITEM is the name of the item number field from the Commander database. This gives me an Invalid column name 'LBLOT' error, however.
Can someone assist?
Please sign in to leave a comment.