Welcome, Guest. Please Login.
04/18/24 at 21:29:30
News:
Home Help Search Login


Pages: 1
Send Topic Print
Using MS Query In Excel (Read 1734 times)
MikeT
Member
**




Posts: 58
Gender: male
Using MS Query In Excel
07/03/13 at 13:05:41
 
Alright...We are trying to figure a way out to have an excel worksheet that when you click on a cell and type in a part number (BKIC_PROD_CODE), then the next column could generate the Description. How do we do this? I have been able to create a MS Query with a parameter value on PROD CODE to let you specify the part number and then pull the related description also.
It would be cool to just fill out a table with part numbers then refresh and have the descriptions populate. Anyone have any ideas?
Back to top
 
 

Michael Tingle
G.R. Manufacturing, Inc.
Trussville, AL
Windows Server 2008 R2 w/ Pervasive v11
50 Users
WWW   IP Logged
BurrKing_Mfg
Member
**


Computer repair can
not be done with a
hammer!

Posts: 66
Gender: male
Re: Using MS Query In Excel
Reply #1 - 07/03/13 at 14:35:40
 
I used a lookup  -  It works great.   We use them for many inventory related task.
 
I have a scheduled task to update inventory every evening.  Then when that data is accessed in excel in the morning they can get good data.  
 
I'm not sure if I can explain, but maybe by looking at the file you can get an idea.  It's an OBDC connection that starts everything off.
Back to top
 
 

12 User Evo-ERP
Pervasive 11
2012r2 Server (needs upgrades)
Evo is fully patched and ready to go
Email WWW   IP Logged
Kelloggs
Active Member
*****


Do crazy people know
they are crazy?

Posts: 785
Gender: male
Re: Using MS Query In Excel
Reply #2 - 07/04/13 at 14:43:29
 
Option Explicit
'--------------------------------------------------------
'--------------------------------------------------------
Public Const odbc_dba As String = "EVO"
Public conn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public cmd As New ADODB.Command
'-------------------------------------------------------
 
 
Public Function sku_desc(the_sku As String) As String
Dim var_sql As String
conn.CursorLocation = adUseClient
conn.Open "provider=MSDASQL;dsn=" & odbc_dba
 
var_sql = "SELECT BKIC_PROD_DESC FROM BKICMSTR WHERE BKIC_PROD_CODE = '" & the_sku & "'"
rs.Open var_sql, conn, adOpenStatic
sku_desc = Trim(rs("BKIC_PROD_DESC"))
 
rs.Close
conn.Close
End Function
 
Public Sub test_my_function()
Sheets("Sheet1").Range("A1").Value = sku_desc("MY SKU ID")
End Sub
 
 Tongue
 
Kelloggs
 
Back to top
 
 

Evo ERP - 35 Users
Dumped MS Access like a hot potato (VB.Net rules!!!)
Email WWW   IP Logged
Pages: 1
Send Topic Print