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.
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?
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:-)
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.
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)
I'm not talking about naming conventions as in tblThis or qryThat, but I have 100+ queries, many of which do similar things from slightly different angles - e.g. a query that gives the total sales per store per month; the same query but per store per product per month; the same query but per sales manager per store per month etc. And these are then used in queries further up the tree that also have similar but slightly different results.
So is there an example database anywhere that I can download that has a decent amount of queries, and a sensible naming convention? I think I'm tying myself in knots because I have only a few tables but lots of queries (for data analysis), whereas most databases I see have lots of tables and a handful of queries.
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
Set objActiveWkb = Nothing Set objCreateWkb = Nothing Set objXL = Nothing rstGetRecordSet.Close dbs.Close Set rstGetRecordSet = Nothing Set dbs = Nothing
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.
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"
Im putting up my Access table/query names for critique, because at some point Ill have to hand over this database to someone else and I want to see how they might react. So if you opened a query list and saw the list below, would you be able to find your way around, or are there too many similar looking queries?
Some of the queries are made up of 6 or 7 of the other queries. I find its easier to see what going on if they are separated out into individual queries, rather than throwing them all into a single select statement, and it means I can re-use things that I know work.
I get stuck on using plurals vs singular (e.g. StoresDeductions or StoreDeductions); how much detail to put in (e.g. BrokersChainsStoresCasesByMonth); how to indicate totals or being grouped by e.g. month; how to indicate date parameters, i.e. whenever a query says MonthRange it asks for this range, and any queries built on top of this one also have MonthRange in their name.
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.
I have taken over exisiting databases and the names for the tables,forms,queries,reports are not technically named correctly.. What would be the easiest way to rename everything accordingly:
tbl for table qry for query rpt for report mcr for macro bas for module frm for form.
Of Course they have names but it is hard to tell when viewing a query for instance if you are looking at a table or a query.... in the SQL View.
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.
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"
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.
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
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.
Access 2010 doesn't seem to like the last line. It gives me an error saying the form name doesn't following access object naming rules.
Sub update_subform() Dim dbsCurrent As Database Dim qryD As QueryDef Dim strSQL1 As String, strSQL2 As String, strSQL3 As String Dim mytmp As String Dim proc As String, myot As String
ok I work a lot on databases but have recently been asked to set up an access database for my team. We are a marketing team within a large insurance company and need a small access database for MI and project management.
I have made a start on this and going well so far but there are some things I need it to do that I dont know how :P
Ive never messed about with Acess before so bare with me :P ok so this is what im looking for, any help would be greatly appreciated.
I have set up various tables for look up wizards for some of the menus on another table I designed for the raw data entry.
I need two tables, two forms - one table for very basic generic data such as
- Job Number - Description - Business Unit - Owner - Due Date - Completion date
I then need to drill down into this to add more information, so its basically two tables on top of each other with co-dependencies.
So for example one of my team enter a new project at the very basic lvl, they have a job number, they know what business unit it is for and they know the date its due, as time goes by and work is done on the project I want them to be able to click on a button that takes them to another form where they can enter information that is linked to the original information.
So they search for job number 00000 and come up with the above data on the first form, I want them to then click on 'Project Information' button and be taken to another form that has a lot more stuff on there, like a description, complications, notes, links to documents etc etc. I tried to do this linking two tables together but it doesnt work as the two forms/tables are not co dependend and are irrespective of each other.
Does this make any sense ? and does anyone know how I might make this work ? Please let me know if I am not clear and I will try to explain as best I can
I would also like to change the form 'theme' aswell and have my companies logo transparent behind the data fields etc, anyone know how to do that as I only have the option to use the standard themes.