Modules & VBA :: Creating Read Only Copy Of BE DB
Sep 2, 2014
I have searched and have not been able to find anything on creating a read-only copy of a back end DB with VBA. I am creating backups of my back end file and would like to create a local read-only copy to use in the event that the regular back end is not available. The code I am using to create the backup is:
Code:
Public Function BackupBE()
'On Error GoTo BackupBE_Err
Dim sourceFile As String, destinationFile As String
Dim aFSO As Variant
Dim path As String, name As String
[code]....
View Replies
ADVERTISEMENT
Jun 20, 2015
How to open a pre filled excel template in read and write mode from msaccess vba and insert data from msaccess tables into specific columns in excel.
Rename the tabs in excel sheet based on a specific column in the access data.
Each row in the table will go to a seperate tab in excel.
Save the excel template after populating the necessary data into different tabs.
View 3 Replies
View Related
Feb 8, 2006
Hi,
I have a Edit Form, where users edit the customer information. I want to add a Button which creates another copy of the same record in the table.
How Can I achieve that? any suggestions?
Regards
-KJ
View 4 Replies
View Related
Dec 7, 2007
I have MSAccess 2003 running on WindowsXP. I have multiple users sharing a single database. When more than one user opens the same database, a copy of the database is being created?? I don't know if this is a standard trait of Acccess or something else. Any explinations would be helpfull.
Thanks
Bob
View 2 Replies
View Related
Aug 31, 2006
Hi Guys!
How would I make a copy of my Database, but only copy the structure and not the data.
I know that you can do this with tables (Copy, Paste > Structure Only), but can you do it with the whole DB?
Cheers!
View 2 Replies
View Related
Jan 20, 2015
I have a relatively small data base.
There are a number of what I call reference tables. These are fairly static and in the main will not change.
There are a further half a dozen tables all linked together.
The system basically takes an enquiry which may lead to a repair taking place. The repair will have a number of jobs and each job may have parts replaced.
What I want to do is have an identical database which to begin with will have exact copies of all the reference tables. The remaining half a dozen tables initially will be empty but grow with time.
The user wants to be able to copy the completed repairs he selects over to the 2nd database (which is initially empty). As weeks go by he wants to select further completed jobs that have not already been copied over to the 2nd database. The 2nd database will be updated so I can't just copy over all completed repairs each time.
I had envisage him doing this by using a front end to the 2 databases and firstly selecting which of the completed jobs which haven't been copied over. This is a fairly straight forward query that will update a field on the repair table.
Once he has done this I was thinking that I could run a query that would pull all the rows from the 6 tables from database 1 and update the corresponding tables/rows on the 2nd database.
I don't actually know how to approach that. The process needs to be simple for the user. ie 1. select repairs to copy over 2. run something to copy them over.
View 11 Replies
View Related
Dec 10, 2013
I am tasked with creating a scientific database of fish catches at various different sampling stations. I envisage the entry form having hierarchy levels, ie year, season, date, sample station, species caught, and then the specific associated data with each species (weight, abundance, length etc) will form each distinct record.
In each year there are 2 sampling seasons. In each sampling season there are up to 20 dates on which samples are taken. On each date there are up to 50 sample stations recorded. And at each station up to 20 species can be recorded.
In order to enter each species caught in a survey, the end user will potentially have to fill the season box with an entry 40,000 times. For each season there will be 20,000 date entries to be made. For each date, 1,000 station code entries, and 20 species entries for each station. What I would like to happen is this.
When the end user is entering the data, he or she will be working through the hierarchy from the ground up. Ie., they will enter a particular species' data (abundance, weight, length etc) at a particular station on a particular date during a particular sampling season. The next entry will be a different species at the same station on the same date during the same season. I would like the duplicated information from the previous record to be copied across onto the new one so that all the end user has to do is enter the species name, abundance weight and length data.
Once they have finished entering all the species data for that particular site, they can move onto the next site which they would fill in the data themselves for the station code. So, in the hierarchy, the first button would copy all the previous data except the species name and associated weight length abundance data. The next button would do the same, except leave the station code blank. The next button would leave the species name, station code and date blank. And so on up the hierarchy. The end user would be able to selectively choose which data is copied over by using these buttons, saving lots of potential extra work doing repetitive entries.
View 1 Replies
View Related
Jun 8, 2015
I'm a access novice who is looking to create a database to store training records for permanent and agency staff, and contractors staff. I need the database to be able to produce reports on how many courses were trained over each month, and the total duration of the course completed (in hours).
View 2 Replies
View Related
Jun 22, 2013
I am interested, is it possible to read currently selected (highlighted) row in table?
I know that this is possible to move cursor on concrete field in table via VBA but is it possible to read record number when we move cursor manually (via arrows)?
View 13 Replies
View Related
Jun 25, 2014
Heres what I need to do.
--> open a recordset
--> read through the records
--> check to see if two fields matches e.g (qty=qty_completed)
--> if all records in recordset meets the above condition then run update statement
I want to put this code inside Form_Close. The code that I'm using checks the two fields for the condition and runs the update statement if condition is met. Problem is this a continuous form and I want all records need to meet the condition before it execute update statement.
Using Access 2010 btw.
View 8 Replies
View Related
Oct 23, 2014
I'm getting an error when trying to read a .txt file into an array for processing. The error and a snippet of the code are below.
Run-time error '9'
Subscript out of range
Dim iFileNum As String
Dim strLineInfo()
Dim i As Integer
Dim strExpensesFile As String
strExpensesFile = "c:FinanceExpensesIn.Txt"
[Code] .....
View 9 Replies
View Related
Nov 5, 2013
I have a text file that I am using VBA to read and print 2 pieces of data to another text file.The code works to a point, in some instances it does not appear to find the end of file but captures and writes all the data. Or, after printing 36 lines correctly, it then stops writing.
I have stepped through the code and it appears to be capturing the data up past this issue but for what ever reason it does not print it to my text file.
PHP Code:
Option Compare DatabaseOption Explicit Public Mode As String Public FUNDREF As String
Public rst As String Function DAILYAUDITTRAIL() Close #1 Close #2 Open "C:UsersTEST IN.TXT" For Input As #1
Open "C:UsersTEST OUT.txt" For Output As # 2 Do While Not EOF(1)
Line Input #1, rst If rst Like "KM56Aasdf*" Then FUNDFINDER
End If Loop End FunctionFunction FUNDFINDER()
[code]...
View 3 Replies
View Related
Jul 16, 2015
I would like to be able to check if a db is open and if it is to prevent the user from proceeding.
I use the Access 2013 Runtime. I can check if a db is open by trying to open Exclusively, using something like
Code: [URL] ....
But if the db is already open Not exclusively and I try to open it exclusively it does not raise an error and it allows the user to open the db in Read Only mode.
I would like to be able to prevent this, because careless and/or inexperienced users may open several instances of the db.
Of course, if the db is already open exclusively it does not allow you to open it exclusively another time.
View 5 Replies
View Related
Oct 8, 2013
For weeks I am trying to read an XML file which needs to be processed in an Access database. I can not find the proper way to:
- find a specific node
- iterate from there
The XML file is an international bank file:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<GrpHdr>
<MsgId>001-2013-09-19-18:12:17</MsgId>
[Code] ....
I started quite simple, just wanted to read to node MsgId. This is the code I use:
Private Sub ReadXML_Click()
Dim aDoc As DOMDocument60
Dim aNode As IXMLDOMNode
Set aDoc = New MSXML2.DOMDocument60
aDoc.async = False
aDoc.Load DLookup("C:Sample.XML")
[Code] ....
Whatever I try: //MsgId or MsgId the results is "No nodes". How to read to XML.
Besides reading one node, the next challenge will be iterating the PmtInf node. There can be 1 in the XML file but also 50.
View 12 Replies
View Related
Sep 11, 2014
I wrote VBA code to pull email messages from Outlook in order to create an alert if a message with a specific subject line is not received. I have the system coded to send the alert if the message isn't found before the system encounters a message with a SentOn date/time more than two hours old.
The code has worked great for over a year, but now my company is migrating to Win8 and I'm having issues with the code. The machine that normally runs the process uses XP and Access 2007. The code also works on another machine running Windows 7 and Access 2010.
The issue I'm having in Win8, with Access 2010, is that the code isn't pulling the most recent message first. Instead, it is selecting a message from about two weeks ago, and then cycling through the other messages from that point. I know there are ways I can code around this, but I don't want to if I don't have to.
Is there a setting that I'm missing? I've included the basic code to pull the email messages below:
Code:
DoCmd.SetWarnings False
Dim ol As Outlook.Application
Dim ns As Namespace
Dim Inbox As MAPIFolder
Dim Item As Object
Dim strSubject, strSentDate As String
[Code] .....
View 3 Replies
View Related
Sep 4, 2013
I can't make edits with ADODB recordset bound to my form.
Access 2010 linking to SQL Server 2008.
Simple form bound to a single table.
Connection string works fine.
Code is as below (cursor etc is set using enums btw).
Private Sub Form_Open(Cancel As Integer)
Dim rst As ADODB.Recordset
If g1OpenRecordset(rst, "tblName", rrOpenKeyset, rrLockOptimistic, False) = False Then
Cancel = True
Exit Sub
[Code] ...
View 3 Replies
View Related
Feb 26, 2014
I have an access program that is stored on a SharePoint site. I want to be able to export report to the computer even if I just open the access program as read only. Here's my code:
Code:
Private Sub btnExport_Click()
On Error GoTo btnExport_Click_Err
Dim db As DAO.Database
Dim strSQL As String
Dim qdfTemp As DAO.QueryDef
Dim qryFilter As DAO.QueryDef
[code]...
View 2 Replies
View Related
Feb 11, 2014
Currently have an Access db filled with different departmental information. Trying to build a workflow mechanism that will validate the status of a certain "Event".
70-80 different projects in one table. This table has Due Date for the project in itlAll of the days between milestones are static. There are 18 different Milestones covered by 6 departments.Table built to hold status of project. which includes notes for every milestone and date completed. 37 fields (date and memo field each with id number to relate back to project table
A generated email that emails the parties who are late or their milestone is upcoming. (can do this already, but see the other requirement)When users receive email they need to reply in the email that was sent to them the date and what the result of what they did in the email. Users will be using mobile devices, laptops and desktops to respond.Could use Collect Data feature, but it is not easily manipulated with vb. Also, it will not all information to be edited in a query.
View 3 Replies
View Related
Jun 15, 2015
I'm having an issue with the database being read only and a type mismatch due to OpenRecordset. I know this database use to work when it when it was just
CurrentSerNum = RecSet(0) +1 was doing the incrementing.
I need the database to increment in a different way now.
Q=manufacture location
1st number is new=0 or used=1
2nd and third number =82
4th is single digit year aka 2015 = 5
6 and 7th are work week aka 25 for this week
8,9,10 are incremental numbers for the units made that workweek, so 001,002,003.
Then week 26 starts the increment starts back at 001.
Code:
Private Sub MakeThoseProducts_Click()
On Error GoTo Err_MakeThoseProducts_Click
Dim NumericSerial As Double
Dim WorkWeek As String
Dim WorkYear As String
Dim WorkWeekNumber As Integer
Dim WorkYearNumber As Integer
Dim Location As String
[Code] ....
View 14 Replies
View Related
Jun 18, 2014
I have a database with two tables, and a form that is bound to the 1st table. I have a duplicate record button on the form. One of the functions I want to happen is when the duplicate button is pressed, one value is copied from the form and added to the 2nd table. The tables are basically set up the same with an ID column which is the key and an autonumber, and the second value is a number. So I want to copy the number to the other table and add a record. What is the best method? Can I use an insert into and just copy from a variable, or is the better method with a recordset. Either way, I have not been able to figure this silly thing out and it is preventing me from moving forward with this database.
View 11 Replies
View Related
Nov 14, 2013
ok so I have two forms open: One is a SP Bookings form with a subform SPDetails Query subform. The other form is the not connected/related SP Contacts Query form, to which users enter Full Name weight age ect. Need to copy the names of the new customers Full Name to the Lookup Contact Column in SPDetails Query subform. I got this far, with my trial runs are commented out. The only thing it does when I click on the button is move to new record on Sp Contacts Query Full Name and Copy the previous record. How do I get the button to copy the Full Name from form SPContacts Query.Full Name to the SPBooking Query.subform SPDetails Query Subform.LookupContact
Code:
Private Sub Command52_Click()
Me.Full_Name.SetFocus
DoCmd.RunCommand acCmdSelectRecord
[Code].....
View 3 Replies
View Related
Feb 28, 2014
I need to create a function that I can launch using a macro that will copy an excel file from one folder to another in the file system.
View 4 Replies
View Related
Jun 25, 2013
This code is supposed to loop around a directory of photos (named after a project), and then copy a new photos (from another directory) to this folder, numbering them and the logging them in a table tphotos.The first time a copy photos to a new directory the code works fine. And I think I had it working fine before, but now when I copy photos to a pre-existing directory that has already photos, it only overwrites the first photo, instead looking for the last photo and attributing the new photo number n+1.
I've done debug.print in the code, and it looks like is not going into If NewFileName = f1.Name, therefore doesn't compare the newfilename with the files in the folder.
Code:
Private Sub cmdAddPhoto_Click()
Dim fs, f, f1, fc, s
Dim fDial As FileDialog
Dim SourcefileName, destDir, FileExt, NewFileName, prjID As String
Dim intSel, FileNumber As Integer
Dim varSelFile As Variant
Dim rsPhoto As Recordset
Dim myDB As Database
[code]...
View 5 Replies
View Related
Mar 28, 2014
I'm getting myself into a bit of a muddle.
I have four tables:
tblinvoice / tblinvparts
tblquotes / tblquoteparts
when I open the tblinvoice form it has tblinvparts as a subform. tblinvoice has a listbox that lists quote numbers linked to vehiclereg. I have a button on the tblinvoice that will open a popup tblquoteparts continuous form linked to the quoteid on tblinvoice. These filtered records have a select button so I can select all or some.
I have now got stuck as I need a button on tblquoteparts popup that will copy the selected records from tblquoteparts and paste them into tblinvparts where quote (on tblequoteparts)=quoteid in tblinvoice.
In a nutshell, I would like to copy selected records from tblquoteparts to tblinvparts.I need to duplicate the records because only 10% of invoices are generated from a quote and the quote parts/prices may differ from the final invoice.
View 9 Replies
View Related
Sep 24, 2014
I am currently trying to copy a tab from one workbook ("List.xls") to another ("IGEN_QC.xls") but I keep getting an error:
Method 'Copy' of object '_Worksheet' failed
Code:
Sub copydata()
Dim wkbSource As Workbook
Dim wkbDest As Workbook
Dim shttocopy As Worksheet
Dim wbname As String
On Error GoTo ErrHandl
[code]...
View 2 Replies
View Related
Aug 27, 2013
I have a projects Database with: Projects_Table, Staff_Table.
Both tables has forms for data entry or update. Each project has many staff allocated to it.
In the Staff_Form I placed the Project_Code in the form heading section. The form opens based on a search criterion on the project_code so it shows the staff for that project only. The issue is when I try to add a new staff for that project on the Staff_Form, the project_code stays blank in the staff_table.
What I need is that the project_code in the staff_table for that newly added person to have the same project_code on the opened form. Simply to link the staff to the project they work in when I add them using the form.
View 1 Replies
View Related