Calling Mdb From Command Line
May 3, 2012I 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 RepliesI 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 RepliesI 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
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?
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
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 !!!
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' "
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.
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 RelatedI 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
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?
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?
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.
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?
Here's the statement
Code:
sqlfinal = "SELECT Employees.ID, Employees.Name "
sqlfinal = sqlfinal & "FROM ((qryDeptVBA INNER JOIN qrySkillVBA ON qryDeptVBA.ID = qrySkillVBA.ID) "
sqlfinal = sqlfinal & "INNER JOIN Employees ON qryDeptVBA.ID = Employees.ID) "
sqlfinal = sqlfinal & "INNER JOIN qryAreaVBA ON Employees.ID = qryAreaVBA.EmpID "
sqlfinal = sqlfinal & "GROUP BY Employees.ID, Employees.Name;"
If i simply remove the GROUP BY line and stick the semicolon at the end of the previous line (.EmpID; ) it works just fine. How is adding a group by line causing an error?I tried adding another parenthes at the beginning ((( and ending the joins as EmpID); and that failed with the exact same error.
I have a main form with 3 sub forms. The main form is tied to a table called QUOTES_MASTER. The first sub form is tied to a table called QUOTE_ LINE_ ITEMS_DIRTGLUE. It calculates the subtotal when selecting items. The relationship is one-to-many linked on QUOTE_ID.
The second sub form adds up total of all line items and is not tied to a table.The third sub form adds ESTIMATED FREIGHT to the PRODUCT TOTAL and is not tied to a table. how to get the values from the line items form inserted into the QUOTE_LINE_ITEMS_DIRTGLUE table as they are added.
I also want to insert the total value from ESTIMATED DELIVERED into the LINE_TOTALS field in the table QUOTES_MASTER.I tried this code on the product total sub form but it doesn't do anything and there are no errors:
Private Sub PROD_SUB_AfterUpdate()
DoCmd.RunSQL "UPDATE QUOTE_LINE_ITEMS_DIRTGLUE SET QUOTE_LINE_ITEMS_DIRTGLUE.SUBTOTAL = Me.PROD_SUB WHERE QUOTES_MASTER.QUOTE_ID = " & Me.QUOTE_ID
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]....
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.
I can change multiple things on a line graph with VBA.
Me.Graph47.chartType = GraphType ' take 65 for line
with me.graph47
.SeriesCollection(1).border.Color = vbblue ' change the line color
.SeriesCollection(1).border.Weight = LineWeight ' change the line weight to for example 3
.SeriesCollection(2).MarkerSize = MarkerWeight ' Change the marker weight, for example 4
.SeriesCollection(2).MarkerBackgroundColor = vbblue ' Change the marker color,
.SeriesCollection(2).axisgroup = 2 ' put this series on the secondary axis
end with
SeriesColection(1) is line with markers. This is correct.But now I want the seriescollection(2) without line, so only the markers. I cheched the MSDN site from Microsoft. The Excel trick with the macro does not work for me.how to hide the line with VBA for only SeriesCollection(2) in Access?
This is my first time using access and got it to work for a blank database.
The problem I ran into is how do I call for the form in the database from my desktop
I tried a shortcut but it does bring it up but i still have to click on the form to open it
Is there a way to make a shortcut on my desktop to open the form
THXS Steve
Hi. I am creating a contact management database. Also I am new to Microsoft Access. How would I create a calling history record for each of the clients in the contact database? What would be the best way and how would I go about it? The calling history ideally would include the call recipient, time, date, subject and notes. Thanks. Take care.
View 1 Replies View RelatedHi All
Nice to find a forum which helps ppl new to VB access 'like me' :). I appreciate any help in this regard.
I generated a report from a query. I would like to modify this report by adding parameters pertaining to 'another' query (say query num 2). There is no relationship between these two queries. How do I call the 'other' query (query num 2) thru VBA and modify its parameters.
Thanks alot in advance
I have a series of IF statements that check my fields and if null call a message telling the user a value must be filled in before the record cab be saved. The code works fine. Here is the code for two fields to show the syntax:
If Len(Me.FName.Value & "") = 0 Then
MsgBox "You must enter a value into FName."
Me.FName.SetFocus
ElseIf Len(Me.LName.Value & "") = 0 Then
MsgBox "You must enter a value into LName."
Me.LName.SetFocus
This same code repeats for each field.
Here is my problem. I have Home, Work and Cell phone fields. The client may not have these numbers. I want to add code that add code for these fields that calls a message box with 2 command buttons(yes & no) with the Message" Does the client have a Home Phone?"
The user would choose the yes or no command button. If the user chooses yes then the same code as above would be called. if he chooses no the ElseIf statement would be called. Can this be done? I don;t know how to wriye the code for the command buttons. can anyone help?
Hi,
I'm having problems calling a simple query from the VBA associated with one of my forms. The code goes thus:
Private Sub Form_Current()
Dim rs As Recordset
Dim db As Database
Dim qryMaxAlp As QueryDef
If Me.NewRecord = True Then
'query database here and find out next alp_key
Set db = DBEngine.Workspaces(0).Databases(0)
Set qryMaxAlp = db.QueryDefs("qryMaxAlpKey")
Set rs = qryMaxAlp.OpenRecordset()
Else
End If
End Sub
The problem occurs on Set qryMaxAlp = db.QueryDefs("qryMaxAlpKey") where I get the error "3265 Item not found in this collection". However the query does exist, and when I run it independantly works fine (it brings back the maximum primary key of a linked table.
So, what am I missing?
Hello.
I have a database that runs a fews tasks for me me when no one is in the office as the systems are quicker and the admin work tedeous and boring, yet necessay. The problem Im having is in calling a database. The problem stems, i think, from the names on the folder. Unfortunately renaming isnt an option because its got many hundreds of users on the server and I dont have the admin rights besides.
The error is coming on .......
Call Shell("msaccess u: eam-shared-dataRes. SalesOutsourceOutsource_DbsDatabase_StoreOutso urce.mdb").
The error message I get says that u: eam.mdb isnt valid .... when its not. The error is caused presumably by the " - 's " and probable after it passes this the " Res. Sales" will cause an error too. So my question Im asking is, is there anyway to make the path read in full, I've tried preceeding with < and ending with > and "" or even ' but still no joy. Can anyone please help, its getting annoying now. :o :confused:
Hello, I have a VBScript that when clicked on opens the command prompt and fires code to upload a query to my website.
What I would like to do is place a command button on my form that will call the script to run instead of having to go and click on it.
I have searched, maybe using wrong terms, but havent been able to get the right code to do this
any help to call this script from a command button would be appreciated.
Dear Access Chart Expert
I have been trying to figure out how I can make the x-axis show month abbreviation names instead of numbers. Please see attached gif.
Currently, I use the Month([DateField]) function to get numbers of the month because if I use Format([DateField], "mmm") to get "Jan, Feb, March" the chart sorts the months in alphabetical order instead of the correct monthly order.
How can I be able to use the Jan, Feb etc... labels and have the chart sort them in the correct month order and not alphabetical order?
Thanks so much...
greatly appreciated.