Hi all,
wondering if anyone can help with a question:
I am working on a system that uses a excel sheet to cost a project that a company are working on. The excel sheet currently imports data from a csv file and sorts it all according to a PIPEKEY reference string i have defined as a unique identifier.
I have stored the associated pricing in a access database that also have matching PIPEKEY's assigned to them. I am at the point now of trying to associate the two together, so that when the excel sheets program is ran (data imported) the access prices will be imported also.
I have asked some friends at work about possible methods for this, 1 mentioned using MSQuery to match the pipekey's but as each key is different it seems i need a unique query for each string, and so upto 1500 queries.
Another passed on this possible coding, but aint sure what and how to get this functioning, can someone take a look and possibly comment on methods for such a process:
Sub situa()
Set DBmain = CreateObject("ADODB.Connection")
DBmain.Open "DSN=MS Access Database;DBQ=D:\putinhere\pathto\db1.mdb"
Set recset1 = CreateObject("ADODB.Recordset")
ctr = 1
Do Until ActiveCell.Value = ""
variable = Cells(3, 14).Value
sqltext = "select price from list where item=" & variable
recset1.Open sqltext, DBmain
Cell this = Price
recset1.Close: Set recset1 = Nothing
ctr = ctr + 1
Loop
End Sub
Would appreciate any help you guys could provide, im new to access and not a learner with VBA and excel programming, but willing to learn
Dean
wondering if anyone can help with a question:
I am working on a system that uses a excel sheet to cost a project that a company are working on. The excel sheet currently imports data from a csv file and sorts it all according to a PIPEKEY reference string i have defined as a unique identifier.
I have stored the associated pricing in a access database that also have matching PIPEKEY's assigned to them. I am at the point now of trying to associate the two together, so that when the excel sheets program is ran (data imported) the access prices will be imported also.
I have asked some friends at work about possible methods for this, 1 mentioned using MSQuery to match the pipekey's but as each key is different it seems i need a unique query for each string, and so upto 1500 queries.
Another passed on this possible coding, but aint sure what and how to get this functioning, can someone take a look and possibly comment on methods for such a process:
Sub situa()
Set DBmain = CreateObject("ADODB.Connection")
DBmain.Open "DSN=MS Access Database;DBQ=D:\putinhere\pathto\db1.mdb"
Set recset1 = CreateObject("ADODB.Recordset")
ctr = 1
Do Until ActiveCell.Value = ""
variable = Cells(3, 14).Value
sqltext = "select price from list where item=" & variable
recset1.Open sqltext, DBmain
Cell this = Price
recset1.Close: Set recset1 = Nothing
ctr = ctr + 1
Loop
End Sub
Would appreciate any help you guys could provide, im new to access and not a learner with VBA and excel programming, but willing to learn
Dean