VBA - Run Powershell File From Command Line

Sep 4, 2011

I am trying to run a powershell file from command line. What i need to do in command line is

cd D:ScriptsWTV-MetaRenamer
powershell -command "& 'D:ScriptsWTV-MetaRenamerwtv-metarenamer.ps1' "

View Replies


ADVERTISEMENT

Modules & VBA :: Read CSV Transaction File Line By Line And Add Correct Transactions To Access Table

Nov 29, 2014

I have a module which reads a CSV transaction file line by line and adds the correct transactions to an access table and places the wrong ones in a logfile.Now some transactions are rejected twice there is even one rejected six times. Whereas one wrong transaction is processed only once. I am certainly overlooking something obvious in the logic but what. Here is the relevant code.

Code:

Function ImportCSVForConfederation(inputCSV, ORG)
Dim TNO As Integer, TACT As Integer, TABLE As String, TLINE As String, I As Integer, J As Integer, K As Integer
Dim FLD1 As String, FLD2 As String, FLD3 As String, FLD4 As String, LogFile As String, LogPath As String
Dim Lim As String, ITNO As Integer

[code]....

View 8 Replies View Related

Modules & VBA :: How To Import Text File Line By Line

Nov 18, 2014

I am having a little difficulty with my importing in Access. Every time I import my text file, the lines will be jumbled. I have been reading up and I found this recordset code that seems to be what I need:

Code:
Dim strLine As String
Dim intLineNum As Integer
Dim MyDB As DAO.Database
Dim rst As DAO.Recordset
Open "C:TestTest.txt" For Input As #1
Set MyDB = CurrentDb
Set rst = MyDB.OpenRecordset("tblResults", dbOpenDynaset)
CurrentDb.Execute "DELETE * FROM tblResults", dbFailOnError 'Clear tblResults

[code]....

Basically, this code will extract data from the text file as long as it fulfills the Mid$ criteria. Here's where my problem comes. Each line in my text file is of different lengths and I have to capture the entire line.

I think using the Left$ function would work, but I don't know how to determine the character count such that the entire line of text would be inserted into the table.

Another difference between what I need and the code above is that, I am required to store each line into each row of my table, meaning

Line 1 is placed in Row 1 Column 1
Line 2 is placed in Row 2 Column 1
Line 3 is placed in Row 3 Column 1
.
.
.
Line X is placed in Row X Column 1.

View 14 Replies View Related

How To Run It From Command Line?

Jul 20, 2007

I have a vba module call runme with this code

Option Compare Database
Sub makequery()
Dim db As DAO.Database
Dim qry As DAO.QueryDef
Dim rs As DAO.Recordset
Dim fld As DAO.Field


Dim XlApp As Excel.Application
Dim xlwb As Excel.Workbook
Dim xlws As Excel.worksheet
Dim xlrn As Excel.Range

Dim x As Integer


Set db = Access.CurrentDb
Set qry = db.QueryDefs("q1")
Set rs = qry.OpenRecordset

Set XlApp = New Excel.Application
XlApp.Visible = True
Set xlwb = XlApp.Workbooks.Add
Set xlws = xlwb.ActiveSheet

x = 1
For Each fld In rs.Fields
xlws.Cells(1, x).Value = fld.Name
x = x + 1
Next fld

Set xlrng = xlws.Cells(2, 1)
xlrng.CopyFromRecordset rs
xlws.Columns.AutoFit
rs.Close
qry.Close



qry.Close


End Sub


I can run it from vb eidit interface by hitting run.
How can I run it from command line?

I tried "msaccess.exe" "C:Documents and SettingsjzhuMy Documents est.mdb" /Excl /X "runme"
But it does not seems to work.

THX.
Jeff

View 4 Replies View Related

What Is A Command Line?

Jul 27, 2004

i want to open a Word Document in access, so i am using the Runapp macro. It says to enter a command line. So, i input the path of the document and run the macro. Then access says it cannot invoke the application.

what is the command line?

in general, how do i open a word document in access using the Runapp macro?

View 8 Replies View Related

Evaluating Command Line

May 30, 2007

Guys, any idea how to evaluate the command line options used when an Access application is started from a command line.
For example I use the following command line: C:..MyDatabase.mdb /parameters:110001110
Then, in VB, I evaluate the string "110001110" and do the further job.
Is there any property or function to return the command line option string?
Thanks

View 5 Replies View Related

Calling Mdb From Command Line

May 3, 2012

I am trying to run the batch job from the command line. I created AutoExec macro in the mdb(msaccess 2007) which is calling someMainMethod() . How can I pass batch job id to the mdb?

View 4 Replies View Related

Symbol For New Line On Command Button ?

Sep 19, 2007

Hello,

I have been trying to find the symbol or text to force a new line on a command button in a Access Form and have not had any luck. I have the command button pretty large and want 2 lines in the button. If anyone knows how to do this that would be great. Thank you very much !!!

View 2 Replies View Related

Short Cut Blues / Command Line Switches / WIF

Feb 14, 2006

Hi Folks,

This may not be an Access problem per se, and if not, I appologize in advance.

I have a FE/BE split database with multiple users. I have found out how to add a command line switch to the shortcuts (the shortcut must go to the application first for any switches to work) which opens the database front end nicely. Problem is, I can't get it to connect to the appropriate WIF.

I have tried copying the text from "Microsoft Access Inside Out" which didn't work as it has "/wrkgroup" rather than "/wrkgrp". My set up wouldn't accept that.

Anyway I'm half way there but stuck now. I don't get any error messages when I use the shortcuts but Access stays joined to whatever WIF it was connected to the last time it was running.

I have searched this site but couldn't find anything regarding this specific problem, in the recent past at least.

Any ideas what I'm doing wrong?

I have copied the details from the 2 shortcuts below. The first is to my database and the networked WIF, the second to Access to return the desktop PC to the default WIF. I have also added the Access version number and operating system version numbers.

This is the shortcut to my database with the workgroup switch set to the WIF created for this database:

Target:
"C:Program FilesMicrosoft OfficeOFFICE11MSACCESS.EXE" "C:EDT DBWC-ED0023001R0.02a-fe.mdb" /wrkgrp "K:EDT FOLDEREDT DBED.00.23.001_WIF.mdw"

Start In:
"C:Program FilesMicrosoft OfficeOFFICE11"

Network Drive WIF Path:
K:EDT FOLDEREDT DBED.00.23.001_WIF.mdw

This shortcut is supposed to restore Access to the default WIF on the desktop PC:

Target:
"C:Program FilesMicrosoft OfficeOFFICE11MSACCESS.EXE" /wrkgrp "C:Documents and SettingsQPUserApplication DataMicrosoftAccessSystem.mdw"

Start In:
"C:Program FilesMicrosoft OfficeOFFICE11"

Desktop WIF Path:
C:Documents and SettingsQPUserApplication DataMicrosoftAccessSystem.mdw

Access path:
C:Program FilesMicrosoft OfficeOFFICE11Access.exe

Access Version:
2003 (11.6355.6408) SP1

Environment:
OS NameMicrosoft Windows XP Professional
Version5.1.2600 Service Pack 1 Build 2600

Thanks in advance,

Keith.

View 9 Replies View Related

Command Line Arguments To Open AND Close Db

Jan 24, 2008

Is there a command line argument to open AND close a db? I am running a schedule task to open a db which has an autoexec macro but I don't want the db to stay open after running the macro. Or is there a close db function in a macro? I see close form but not db.

View 2 Replies View Related

Command Line To Display Access Report

Sep 19, 2004

I am looking for help to to generate a command line to automatically run a report within a windows program I am using. The program I use has command line fields to automatically open the access report when I complete my program session. I have tested the command line with a standard C:.... .exe to open Word, Access, etc.

I have tried using the create shortcut and snapshot methods without success and wondering if a macro is needed (havent a clue).

Hoping someone can help!

thanks... Keith

View 2 Replies View Related

Command Line (Input, Output, Error)

Mar 16, 2007

I had looked at the Shell() function but I don't see it doing anything such as input and output.

Does anyone know the use of the VBA's command line that would send an input and receive an output to the VBA's variable?

View 2 Replies View Related

General :: Opening DB With A Space In Filename Via Command Line

Jan 21, 2013

I am working on supporting spaces in the DB filename. I got the rest of my program working... other than being able to invoke Access with the specified filename for it to open.

Code:
C:Documents and Settingsc_mlueckMy DocumentsFandango>"C:Program FilesMicrosoft OfficeOffice12MSACCESS.EXE" "Schema Ideas.accdb"

C:Documents and Settingsc_mlueckMy DocumentsFandango>dir "Schema Ideas.accdb"
Volume in drive C has no label.
Volume Serial Number is C8E4-5856

Directory of C:Documents and Settingsc_mlueckMy DocumentsFandango

01/18/2013 04:45 PM 3,203,072 Schema Ideas.accdb
1 File(s) 3,203,072 bytes
0 Dir(s) 125,846,482,944 bytes free

The envoking of MSACCESS.EXE results in:

Does Access 2007 MSACCESS.EXE not support DB's with a space in the file name being spefied to auto-open via command line switches?

View 3 Replies View Related

How To Enter Commands In Command Line To Type Queries

Oct 3, 2014

I have had my 4th SQL/APP Dev lab class, however I missed the 5th.

Our 5th lab was .

1. Create 3 tables, populate with given data and create relationships. 'Customer, Invoice, Payment'

2. We were given 8 queries to try do, we had to come up with which commands would be used.

I have no 1 completed.

As for no 2.. we are still learning all the commands, so the lab here is for us to find what commands we think will be used. I have researched and have them all 6 queries we have to run.., I have all those commands written out on paper which I think are answers..how to find the command line to test them.

I'm using Access 2007 on Windows 7.

View 1 Replies View Related

Correct Syntax To Write Command Line Able To UPDATE More Than One Field In Table

Nov 24, 2014

what is the correct syntax to write a command line able to UPDATE more than one field in the table records having multiple WHERE criteria.

Here is my challenge:My TableI has the columns A, B, C and D which are populated, for example, as follows:

TableI
A B C D
1 2
2 6 4 3

1 7 5 9
1 2
2 5 8 5
etc.

I also have a FormII which updates TableII. Among the existing fields of TableII there are the fields C and D (same as above). When saving data entry thru the save button of the FormII, fields C and D will be naturally saved on the TableII. Well, I also want C and D info updated into Table I as well, but only when field A=1 and B=2.So what I need (for the click event of the button save in the FormII) is to open TableI and either insert or update it with the values of the fields C and D in every record WHERE A=1 AND B=2.For instance, assuming C=& and D=%, the desired result should be as follows:

TableI
A B C D
1 2 & %
2 6 4 3
1 7 5 9
1 2 & %
2 5 8 5

I did not find any examples in the net including multiple criteria..Here is what I wrote unsuccesfully:

Private Sub BtSalvarFrmII_Click()
CurrentDb.execute "UPDATE TableI"
Set FieldC = Forms!FrmII!FieldC.value AND Set FieldD = Forms!FrmII!FieldD.value WHERE FieldA = 1 AND FieldB = 2
Docmd.save
Docmd.close
End Sub

What would be the correct syntax?

View 7 Replies View Related

Append New Line To Text File

Oct 25, 2005

I want to open a txt file through my access database and append a line to it. When I use the opentextfile method for appending but it always appends my new text line to the end of the last line. I want it to append the new text to a new line. I have tried object.skipline but this is not supported when appending?

This is what I get:
"oldline" "newline"

but I want:
"oldline"
"newline"

Here is my code

sub ConcatenateTxtFile ()

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fd.OpenTextFile(dpath, ForAppending)
'Need a line here to skip to next line
f.writeline ("newline")

End Sub

View 1 Replies View Related

Send CSV File With A Footer As Last Line

Nov 8, 2012

One of our vendors needs data from a table with a header (as HD) and a footer (as FT). The header is easy but short of converting the query to a report, how do I send CSV file with a footer as the last line.

View 1 Replies View Related

Modules & VBA :: Insert (Append) First And Last Line In XML File

May 31, 2015

I need to insert(append) first and last line in xml file...

So I have xml file and I need to insert one line to the top and at the of the text... Xml file contains Cyrillic characters and method to recreate xml file is going wrong with characters conversions... The last line a can append easy but the first line is a problem...

View 10 Replies View Related

Modules & VBA :: Writing To Text File With Line Feeds

Jun 22, 2015

I have a function which takes a recordset and writes the contents to a text file. One of the fields in the recordset is a free format text field, the contents of which originate from a text box on a form. Occasionally, a user can hit the 'Enter' key to add a new line (carriage return) to the note within the text box.

The problem is, when the output text file is subsequently imported to Excel, the carriage returns within that text field serve to move the next piece of data to the next row (even though the CR is within the double-quote text-qualifier in the text file)I want line breaks within the text field to be retained within the cell.

One option would very simply be to replace the carriage returns with simple spaces in the write function. I could do that quite easily. However, I would prefer to retain whatever the user has entered into the text box, including line breaks, if at all possible?So if the user broke his free format 'note' into multiple lines (for whatever reason), it would similarly appear as multiple lines in the same cell (and in the same row / record) in the Excel worksheet.

I could replace the carriage return with some obscure character during the write, then switch it back during the Excel import, but that seems a little clunky (plus Murphy's Law dictates that no matter how obscure a character I choose, somebody, at some point, will genuinely use it, and it will get switched out. Which means I'd have to use a non-printing character?could I simply replace the carriage return with a line feed? (Or is it the other way around? I always get carriage returns and line feeds mixed up!)there's a simple way around this but I always get confused as to precisely which ASCII character the 'Enter' key produces when keying into a text box.

View 14 Replies View Related

Creating A Command Button To Open A File

Jun 13, 2006

I have set up a database that houses file locations. The form that I have made shows a job # and the files that correlate with it. I would like to set up a command button that will read the file name and open it in Excell. If any one know how to do this I would greatly appreciate the help.

View 3 Replies View Related

Open And Excel File W/ Command Button?

Nov 3, 2006

I am trying to open a workbook with a command button on a form however the path to the file is giving me a fit. The path for the file location contains spaces and I am going blind trying to figure out how to rectify the path. Heres the line. I am sure someone here will see this problem quick! Thanks.

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stAppName As String

stAppName = "Excel.exe N:OPSCOMMONOpsResearchContact CenterDI CCL Reporting dBApps by Agent.xls"
Call Shell(stAppName, 1)

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

Heres the mess I made out of it:
stAppName = "Excel.exe N:OPSCOMMONOpsResearchContact" & Chr(32) & "CenterDI" & Chr(32) & "CCL" & Chr(32) & "Reporting" & Chr(32) & "dBApps" & Chr(32) & "by" & Chr(32) & "Agent.xls"""

:confused:

View 6 Replies View Related

Command Button To Open Excel File

Nov 15, 2006

Is this possible? A command button when click will open an excel file... :rolleyes:

Cheers!
Sheila

View 5 Replies View Related

Running A Batch File From Command Prompt Using VBA

Apr 25, 2008

Hi,

I know this can be done but I'm a novice at VBA. I have a batch file AutoLoop.bat which I run from command prompt at the moment. The idea is to run a VBA routine behind the onClick event of a command button in Access which would run this batch file in command prompt automatically. Say if the batch file path is I:AUTOGENLOOPGENAutoLoop.bat,
what VBA code can be used.

Thanks for any help.

View 1 Replies View Related

Modules & VBA :: Save As Command With Variable File Name?

Aug 1, 2013

i'm using a form with an unbound text box to temporarily hold data that i want to use in several other places (all those functions work great). last step is to save the newly created table with a different name (will be used for a mail merge later so must be a separate table or else we'd have to filter thousands of records during each mail merge) and i want to use the data i've temporarily held in my unbound text box within my form as the name in the save as function.

can i specify a variable as a file name within the save as function? is there a better way?

View 4 Replies View Related

Forms :: Opening PDF File From Button Command

Aug 19, 2015

I would like to open a PDF document using a button control on a form to a file path listed in a field on the form (Me.Link). I am trying to use the followHyperlink code but I keep getting the runtime 490 error.

This is the code im using:

Dim strFilePath As String
strFilePath = Me.Link
Application.FollowHyperlink (strFilePath)

If I put a filepath to one of the pdf documents in the place of (strFilePath) it opens that pdf document fine but not when I declare a filepath based on the one listed on the form.

View 8 Replies View Related

General :: Command Button Not Working In ACCDE File

Oct 19, 2014

I have created an accdb file and saved as an accde file. The accde file opens with a form with command buttons. But the commands buttons do not work with the accde file (they do work with the accdb file). How do I get them working.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved