Db Link via code (Klatuu Help)

D

DDBeards

I had posted help back on 6/27 and got help back from Klatuu but need some
clarification.

Problem. I am trying to update links from a deveopment environment to a
production environement via code.

I have created "UTbl_Link" Table that has 33 records each with 3 fields:

TableName - contains the name of the table
ConnectString - contains the name and location of the mdb
ProdDev - contains a "D" or "P" for development or production

I have also created a form "UFrm_Rlink" that has a pull down box "PD_Box"
with two choices "P" or "D" and an execution button to run the code.

I am having problem with one line of code you supplied so I am sure I have
typed it wrong or translated it wrong. I have provided both what I was given
and what I have typed.

Your code
' Me.lblMsg.Caption = "Refreshing " & tdf.Name
' strNewPath = DLookup("[ConnectString]", "tblBeList", _
' "[TableName] = """ & tdf.Name & "" AND [ProdDev] = """ & _
' Me.txtEnvironment & """")


My code
Me.lblMsg.Caption = "Refreshing " & tdf.Name
strNewPath = DLookup("[ConnectString]", "UTbl_Link", _
"[TableName] = """ & tdf.Name & "" AND [ProdDev] = """ & _
Me.PD_Box & """")

the strNewPath line crahses. Please help

Thanks again

DDBeards
 
P

Paolo

Hi DDBeards,
I'm not Klatuu but I see the problem, you forgot a quotation marks. Try this

strNewPath = DLookup("[ConnectString]", "UTbl_Link", _
"[TableName] = """ & tdf.Name & """ AND [ProdDev] = """ & _
Me.PD_Box & """")

HTH Paolo
 
D

DDBeards

Thank you Paolo and Klatuu for your help, this is GREAT! and will save me
alot of time down the road.

DDBeards

Paolo said:
Hi DDBeards,
I'm not Klatuu but I see the problem, you forgot a quotation marks. Try this

strNewPath = DLookup("[ConnectString]", "UTbl_Link", _
"[TableName] = """ & tdf.Name & """ AND [ProdDev] = """ & _
Me.PD_Box & """")

HTH Paolo

DDBeards said:
I had posted help back on 6/27 and got help back from Klatuu but need some
clarification.

Problem. I am trying to update links from a deveopment environment to a
production environement via code.

I have created "UTbl_Link" Table that has 33 records each with 3 fields:

TableName - contains the name of the table
ConnectString - contains the name and location of the mdb
ProdDev - contains a "D" or "P" for development or production

I have also created a form "UFrm_Rlink" that has a pull down box "PD_Box"
with two choices "P" or "D" and an execution button to run the code.

I am having problem with one line of code you supplied so I am sure I have
typed it wrong or translated it wrong. I have provided both what I was given
and what I have typed.

Your code
' Me.lblMsg.Caption = "Refreshing " & tdf.Name
' strNewPath = DLookup("[ConnectString]", "tblBeList", _
' "[TableName] = """ & tdf.Name & "" AND [ProdDev] = """ & _
' Me.txtEnvironment & """")


My code
Me.lblMsg.Caption = "Refreshing " & tdf.Name
strNewPath = DLookup("[ConnectString]", "UTbl_Link", _
"[TableName] = """ & tdf.Name & "" AND [ProdDev] = """ & _
Me.PD_Box & """")

the strNewPath line crahses. Please help

Thanks again

DDBeards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Db Link via code 3

Top