Modules & VBA :: Naming A File - SOW Number

Oct 23, 2013

I'm currently working with Access 2007 building a way to create PODs to clients. I have most everything laid out, one problem I can't seem to get around is naming the file the SOW #. Below is the code:

Function Run_all_PODs_01()
Dim myPath As String
Dim name As Object

DoCmd.OpenQuery "Q5 SOW bill requested data points all", acViewNormal, acEdit
DoCmd.OpenQuery "Q5 SOW bill requested All 01", acViewNormal, acEdit

[Code] ...

I can't seem to get the name to equal the SOW number.

The table that I'm trying to reference is "SOW bill requested data points" it is a basic table one row with a column header as SOW #. I'm not sure how to tell it name the file that data point in the column.

View Replies


ADVERTISEMENT

Forms :: Naming File Exporting To Spreadsheet

May 10, 2014

I am exporting a single record to a spreadsheet. The code I have works fine. The problem is I want to have the spreadsheet contain the information that is in one of the forms textboxes, in this case a dogs name.

I have created a query to get the dogs name which works but I dont know how to get that query to run and then be put in the file name.

The code that I have is below

Code:
Private Sub btn_ExportDog_Click()
Dim strday As String 'The date
Dim sDest As String 'Where the file will be copied to
Dim sSource As String 'The name of the file to be copied
Dim strDogName As String 'The name of the dog that is geting exported
Dim strBackUp As String
strBackUp = "c:GPandDetectionDogTrainingLogBackUp"

[Code]...

View 1 Replies View Related

Modules & VBA :: Naming New Archive Table

Jan 8, 2014

I have a Database in which I would like to archive data once it is now longer actively being used. I have VBA code that does everything i need it to, however I would like to name the new archive table related to the dates in the data being archived. Below is the code I am using to archive and delete the information from the main table.

Code:
Dim strSQLCreate As String
Dim strSQLDelete As String
Dim strArchiveTableName As String

[Code].....

I know it will be in the "strArchiveTableName" variable, I am just not sure how to pull the dates out of the data being moved. The TestData table holds a date and time for each test, and the earliest and latest dates is what i want to append to the table name.

For example: Currently "tblTestData_A102Archive"What I want "tblTestData_A102_1/1/2012-1/1/2013"

View 3 Replies View Related

Modules & VBA :: Verify A Network Connection / Bad File Name Or Number

Mar 22, 2014

I have a picture stored on a network file share that populates each time a particular form is opened. Every so often we lose our connection (which is a different issue altogether). Right now the error I get after much grinding away, is "Bad file name or number"

Is there a quicker way to check for the connection before it spends 45 seconds trying to find the whole path?

Code:
Dim vFolderPath As String, dirFile As String, strFile As String
vFolderPath = Nz(DLookup("FolderName", "tblCodes-FolderControl", "FolderKey = '" & "Profile" & "'"))
dirFile = vFolderPath & Dir(vFolderPath & ctrl_people_id & " *", vbDirectory)
strFile = dirFile & "profile_pic.*"
'Debug.Print dirFile
On Error Resume Next
If Dir(strFile) <> vbNullString Then
Me.[ctrl_ImageFrame].Picture = dirFile & "" & Dir(strFile)
Else
Me!ctrl_ImageFrame.Picture = "X:~stuffprofile_icon.png"
End If

View 4 Replies View Related

Modules & VBA :: Output Report To Excel With Naming

Aug 19, 2013

Been hunting a round looking for some code that will output my access report to excel but more inportantly add a unique field from the report to the name of the file. example would be [FileName] & [ReferenceNo].xls.

View 2 Replies View Related

Modules & VBA :: Excel Export Naming Convention

Jun 8, 2015

I would like to add the "Month" of the information queried to my file name at export if possible. I included my current code and an example of how I would like the title to read.

DoCmd.TransferSpreadsheet acExport, 10, "tblStarzIncentivePayoutExport", "C:StarzExportsIncentive Payouts" & " " & "Ran" & " " & Format(Date, "mm-dd-yyyy")

I would like the file to be named:

Incentive Payouts "Month out of the date ran in the query" Ran 06/08/2015

Is it possible to do?

View 1 Replies View Related

Modules & VBA :: Word Naming And Emailing Attach From Access 10?

Apr 21, 2015

I need to create a word file (it needs to be word) based on template (not a very complicated template) max 1 to 1 and 1/2 pages long.

the word doc needs to be named from the recordset but for now assume 12345.doc and the next one will be 12346.doc etc (I have a unique number system - available from tables /query .

i can either make the word doc in code or use a template (template would be better) recordset could have 20-30 in it each time i run it - but to be run every week

second half is how to email this out. i had in mind a email system

email to . test@testhotmail.xyz
file attach = this folder where the docs are store and attach 12345

in a loop

so either

create word file - email word file in a loop each time or create all the word files and then send them individual

View 4 Replies View Related

Modules & VBA :: Check For Documents With Specific Naming Structure

Apr 30, 2014

I want to hit a button and then it scans for a file on a server and return with a message box saying if it exists or not.

I want it so when I am on a Specific record it will search for certain requirements.

All the file names are pdf files with the same naming structure

SIT yy m(m) dd Last Name Unique Identifier
Example:
SIT 14 5 21 Smith ABCD1234567
SIT 14 10 21 Smith ABCD1234567

So I hit the button it sweeps the file path and looks for documents with this naming structure.

Last Name and Unique Identifier are fields within the db.

Last Name = txtLName

Unique Identifier = txtUniqIden

So far I have the following:

Code:
Dim strDirName As String
Dim strDirPath As String
Dim strDirName As String
Dim strDirPath As String

[Code] ....

So Far it works and I used the actual name of the items an it finds them but I need to up each record.

I have no clue how to begin with the strDirName. How to get it to scan the file name in a specific format.

View 3 Replies View Related

Modules & VBA :: Excel File When Formatted In Access Shows Wrong Number

Nov 7, 2013

I am opening an excel file from access and changing the formatting from "dd/mm/yyyy hh:mm" to number with 15 decimal places.Then I am linking the file to the database and subsequently doing a lookup on the date time on the access form against this table.The excel file when formatted from vba in access shows the wrong number

datetime = 03/05/2013 11:26
database number = 41397.4763888889
Excel file number = 41398.4763888889 (which would equal 04/05/13 11:26)

now if I do it manually then I get 41397.4763888889 or if the macro is in excel I still get 41397.4763888889.Also I have tested the code with manually editing the excel file and this works fine.

Code:
Private Sub Command288_Click()
Dim s As String
Dim t As Integer
Dim ws As Worksheet
s = LaunchCD(Me)
MsgBox (s)

[code]....

also this brings up a form and then I select the field required for the lookup and with the button is pressed the rest of the code runs as follows.

Code:
Private Sub LoadData_Click()
Dim w As String
w = Forms![frmList1]![Combo0]
w = "[" & w & "]"
Dim dtA As String

[code]....

View 7 Replies View Related

Modules & VBA :: Naming Range To Export Data To Access Table?

Dec 15, 2014

I am trying to write code in an excel worksheet to try to export excel data to a table in access.

The range in which the data is situated in excel varies. So the range address varies with the data. After a lot of searching I wrote the following code which works for a range which is fixed. The code is the following:

Dim acc As New Access.Application
Range(Range("b22"), Range("b22").End(xlDown)).Select
ActiveWorkbook.Names.Add Name:="ghazla", RefersTo:=Selection
acc.OpenCurrentDatabase "D:PayRollFactoryJasminePayroll.accdb"
acc.DoCmd.TransferSpreadsheet _

[Code] .....

As one can see from the first two lines of code I am trying to first delineate the range and then to name it. The intent is to name the range "ghazla" and so to cater for the fact that the extent of data varies.

The code works with the fixed range ="Sheet2$B140". However what I need to do is to adjust the code so that I can insert "ghazla" as the range name so that this can vary.

View 5 Replies View Related

Forms :: Auto Generate File Number Based On Number Of Records In Year

Jan 21, 2014

I have a form [IUDATA]

I have a add record button.

I have a date field [DATEIN]

I have a text field [DRPNO]

If the [DPRNO] field is empty, I would like the user to have the [DPRNO] field be automatically populated after the user enters a date.

I'd like the format of [DPRNO] to be "dpr YY-XXX"

Where:
YY is the year of the [DATEIN] field and
XXX is number of records in that year.

So for example, if it was the 4th record with a 2013 date the [DPRNO] would be dpr 13-004.

View 12 Replies View Related

Modules & VBA :: Determine Excel File Type Without Opening The File?

Aug 14, 2015

Question: Is it possible, using VBA, to determine the actual Excel file type without opening the file?

I receive data files from other departments. Seems like every time someone changes their download structure, I end up with file types that do not match the download extension (example: xlm file with a xls extension). The files can't even be opened because of this. I think I can fix it if I could figure out how to determine what the file type really is.

I'm using Office 2010.

View 3 Replies View Related

Modules & VBA :: File Open Dialog Does Not Allow Selection Of All File Types

Oct 4, 2013

I recently upgraded a DB from 2003 to 2013 and ran into the following problem.

I have a button that opens a file dialog box and allows the user to upload a file to a predetermined location (and store the address as a hyperlink). I borrowed this code from someone else on here and modified it slightly.

In any case, the button still works, but now when it opens it doesn't have an option for "All files" under file types. So I can upload MS Office files, text files, etc., but not PDF files which are by far the most common types my users upload.

Here's my code and a screenshot is attached.

Private Sub Command35_Click()
Dim dd As Integer
Dim fileDump As FileDialog
Set fileDump = Application.FileDialog(msoFileDialogOpen)
dd = fileDump.Show

[Code] ....

View 3 Replies View Related

Modules & VBA :: Filesystemobject File Picker Does Not Highlight Initial File

Jun 20, 2014

I am using the following code to select files using Microsoft Office's file dialog:

Public Function fTestFilePicker() As String
Dim fdFileSelection As Office.FileDialog, lstrFileName As String
Const kInitialFile = "F:TestbedTest.txt"
Set fdFileSelection = Application.FileDialog(msoFileDialogFilePicker)
With fdFileSelection
.AllowMultiSelect = False

[Code] .....

When I execute it, the file picker goes to the right folder but does not highlight the file test.txt even though that file name shows in the File name text box. Is there any way to correct this?

View 7 Replies View Related

Modules & VBA :: Sequence Number In Query Use A Starting Number

Sep 20, 2014

creating sequence number in a query using a starting number. For example i want to use the starting sequence number as 5

---SEQNUM---------COLOR-----------
-----5------------------blue--------------
-----6------------------red---------------
-----7------------------orange-----------
-----8------------------black-------------

View 2 Replies View Related

Modules & VBA :: Get Full File Path And File Name?

Oct 28, 2014

I'm having another one of those days but I'm getting a file path and file name from a dialogbox and forgotten when the VBA property is to return the full file path and file name.

This code works fine for return the filename only:

Code:

Private Sub TEST()
Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
For I = 1 To f.SelectedItems.Count
MsgBox Filename(f.SelectedItems(I))
Next
End If
End Sub

Instead of using 'Filename' what else can I use to return what I need?

View 3 Replies View Related

Naming Conventions

Mar 25, 2006

All,

I try to use common naming conventions wherever possible.
Every now and then I come across what should be common but I can't find a standard method to use.

It not really a huge problem, but as this is the General forum I thought I'd ask.

Does anyone have a good link with a long list of conventions?

http://www.mvps.org/access/general/gen0012.htm
http://www.databasedev.co.uk/naming_conv.html
http://www.acc-technology.com/namconv.htm

Are all good places to look.

Does anyone have a standard way to name a table which permenantly resides in the client but the data is very much temporary.

I use these tables a lot and was just interested.

No matter if there isn't one, just seems a good idea to open up a discussion for anyone else who wastes time like I do on the name of objects etc. rather than doing the work:-)

Any and all ideas on the subject most welcome.

Cheers, I hope this becomes a useful thread.

View 12 Replies View Related

Naming Conventions

Jul 24, 2007

Following on from entries in a previous post (see http://www.access-programmers.co.uk/forums/showthread.php?p=612071#post612071 ) I wondered what people considered to sensible naming conventions.

For example should a table be called "Order Details", "Order_Details", "OrderDetails" or "tblOrderDetails".

Should variables in VBA be given a prefix which indicates their type eg strString or intInteger etc.

Lets have your views.

View 14 Replies View Related

Naming Conventions

Apr 15, 2005

When I started using Access excel had been my closest app. to a database.

My first attempts to build a database failed because I tried to build the database like sets of excel sheets.

Any ways I then discovered Normalization, that helped a lot.
Now I am wondering about naming rules.

I have seen a few examples like:
ThisTableName,
strThisFieldName,
this_field_name,

Is there one standard or method or is this just user preference?

View 7 Replies View Related

General :: Importing Txt File With Large Number

Feb 11, 2014

I am importing a delimited .txt file that has a number field. A value for a record coming in is 36,767 and Access is not accepting it. If I redefine the field as long integer or as double, I can manually update the record, but as soon as the file containing the record is imported, the field reverts back to integer.

How do I format the field with VBA so that Access will accept the value and not revert to integer?

View 3 Replies View Related

Naming Conventions (possible Sticky)

Jan 25, 2008

Not only do a lot of people not format code (nothing a copy/paste dump of 300 lines with no spacing), they use control names like textbox1, combo47, and form12. It drives me bonkers. This is in part from Expert One-on-One Microsoft Access Application Development. Please read it and understand it. (The book isn't bad either.) Reagrdless of whether or not you agree with it, the point here is that you use some sort of naming convention, even if it's not this one as variants exist. Without it, maintaining your code is exponentially harder, and asking for help in here without some sort of standard convention is far less likely to get a response.That is all. :)Leszynski Naming Conventions (http://en.wikipedia.org/wiki/Leszynski_naming_convention)

View 4 Replies View Related

Naming A Field In A Query

Nov 4, 2005

Hi,

I need to name my field in my select query
i.e : - name: [...

but instead of it just being text, i need it to calculate its name by month i.e
Month([Starting date:])+1

On my query i ask the user to input a starting date and i then work out information based on that. How can i name the a calculated month

Thanks
k0r54

View 1 Replies View Related

Query To Xls (naming Problem)

Dec 12, 2007

i have the following code and it works fine makes a xls called trash

now i want to be able to name the xls myself (via a form)
form called xlsexport
and the field i wil have to name it willb e called xlsname

is it a simple case of

objActiveWkb.Worksheets(1).SaveAs FileName:="c:[form]![xlsexport]![xlsname]- this doens't sound right to me ??

code below( yes theres some bits in there i need to tidy i know)


Private Sub Command0_Click()

Dim dbs As DAO.Database

Dim rstGetRecordSet As Recordset

Dim objXL As Object
Dim objCreateWkb As Object
Dim objActiveWkb As Object

Set dbs = CurrentDb
Set objXL = CreateObject("Excel.Application")
Set objCreateWkb = objXL.Workbooks.Add
Set objActiveWkb = objXL.Application.ActiveWorkbook

objXL.Visible = True
objActiveWkb.Sheets.Add
objActiveWkb.Worksheets(1).Name = "Trash1"
Set rstGetRecordSet = dbs.OpenRecordset("Trash")
objActiveWkb.Worksheets("Trash1").Cells(1, 1) = "test"
objActiveWkb.Worksheets("Trash1").Cells(2, 1).CopyFromRecordset rstGetRecordSet

' note replace names with correct qry
'objActiveWkb.Sheets.Add
'objActiveWkb.Worksheets(2).Name = "ABC"

'Set rstGetRecordSet = dbs.OpenRecordset("ABC_Query_Name")

'objActiveWkb.Worksheets("ABC").Cells(1, 1).CopyFromRecordset rstGetRecordSet



objActiveWkb.Worksheets(1).SaveAs FileName:="c: rash.xls"

objActiveWkb.Close

Set objActiveWkb = Nothing
Set objCreateWkb = Nothing
Set objXL = Nothing
rstGetRecordSet.Close
dbs.Close
Set rstGetRecordSet = Nothing
Set dbs = Nothing

View 4 Replies View Related

Naming Combo Boxes

May 22, 2006

Hi folks,

What is the abbreviation you use in MSAccess when naming combo boxes?

i.e a label is abbreviated using lbl.

Memory blank so appreciate some help thanks!

View 2 Replies View Related

Setting Naming Conventions For IDs

Apr 25, 2013

Is it possible to set a naming convention for auto numbered records?

For instance in a table that holds information on customers, could you start the auto number scheme at something like 'cust01' rather than the normal autonumber scheme that's starts at 1 and continues.

Just so I am absolutely clear, table could be:

Customer_ID
First_Name
Last_Name

cust01
Ben
Robinson

cust02
Dom
Rodgers

cust03
Lilly
Balentine

cust04
Luke
Teal

rather than the normal:

Customer_ID
First_Name
Last_Name

1
Ben
Robinson

2
Dom
Rodgers

3
Lilly
Balentine

4
Luke
Teal

View 1 Replies View Related

Automatic Document Naming

Jan 20, 2015

I'm looking to design a form in Access that has a documents number field. Ideally, this field would auto-generate a document number based on a logical naming convention.

View 7 Replies View Related







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