Access 2010 VBA Parameter Query

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,664
Hello All,

I have the following code that I inherited:

Code:
'Import the updated list
    
    'Variable Declaration
    SrcFilePath = ThisWorkbook.Path & "\01_Database.accdb"
        SrcQuery = "SELECT [QryFNL_Report].* FROM [QryFNL_Report];"
    TgtSheet = "DATA_Clean"
    Tgt1stCell = "iPt_NewData"
    TgtHeaderOffset = 8
    ' Create Parameter Object.
    Set Param1 = Cmd1.CreateParameter(, adInteger, adParamInput, 5)
    Param1.Value = " "
    Cmd1.Parameters.Append Param1
    Set Param1 = Nothing

I know this code is wrong how do I just press the enter key in the code to be able to use the parameter query report from the Access DB?
 
Who says the problem is a user name? What about the "|" you have in your posted path? I've never seen a path like that.
And who is Smitty? Have you posted this problem somewhere else?
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Who says the problem is a user name? What about the "|" you have in your posted path? I've never seen a path like that.
And who is Smitty? Have you posted this problem somewhere else?

It is the User Name path. There is no | in the posted path I only see the \. I tried to change these parameters to get it to work on my laptop at home now I am at work and the username and path are ok.

Again this program worked fine until somebody moved it either from another machine or from a server. I inherited this application.

If I am wrong quote it here.

Smitty is Chris Smith who is one of the moderators of the Excel Forum whom I have know since 2002 and he is a Excel MVP.

We use a Excel front end to connect to the database in Access and then bring the other data into Excel.
 
Upvote 0
C:\Users\11111111\Desktop|Disbursements\Disbursements-DebtBalance

it's right there between Desktop and Disbursements

He said it was a | pipe symbol it is a hyphen and it should be an underscore Disbursements_DebtBalance.

Come on guys who cares about this symantic type question?

I suspected I knew where the problem was and Smitty figured it out with me online.

Someone had overwritten a header file in a Access Table called CLS_Current and a date was somehow placed there.

I corrected it and now the code is running perfectly.

So what I have learned is to check for srcQuer and FilePath in the Immediate Window in Excel VBA and I have learned to verify the path name at a break point.

I have also learned more and more to look in the not so obvious places like this.

Thanks all we can mark this thread solved.
 
Upvote 0
it IS a pipe symbol between Desktop|Disbursements

and if the error message you were getting was "invalid path" then the difference \ and | are VERY important
 
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top