Modules & VBA :: Adding Table To Back End Of Database
Feb 27, 2015
Can I create a table in the back end of my database using VBA in the front end? My client is using this system and I can't easily go to their location. I need to create a table on the back end and have it available in the front end applications. My thought is to create a front end only for the purpose of updating the backend with this new table. My idea is now to have it open with a button for the user to click - this will add the table to the backend with the required fields, confirm the update was completed and then close. This app then would be trashed so it would not be run again. (Though I would put a check in the VBA that if the table existed, the user would get a message box and the coding stopped to avoid overwriting the existing file.)
And once the table is created, is there a way to programmatically link it to the front end. I will be providing a new front end with this update so I could add something in the new version.
I have a database at work with 5500 records, how ever the first 1000 have been lost. There remains records for each customer but the first 1000 records showing what they ordered have disapeared.
I have back ups of the database going back with the first 1000 records complete.
How would i take the 1000 records and add this to the current database where the information is missing? so it wouldnt mess up recent records? could some one provide me with a step by step account. Would be much appreciated!
my problem is that when i make a booking on my booking page it all saves, but when i go to the table where the bookings should all be kept, they all dissappear and only the recent booking i have made shows.
I have a Back end (with password) which resides in a netdrive while the front end is installed in each individual users desktop, the problem is, some of the users netdrive was mapped in a different way (different letters..some are J others are G). I'm looking for code that I can relink the database to the front end in runtime, I did try to look in the net but I can't find anything that I can put the password as parameter.
this sample code from Dev is good, but i got an error because the database requires a password.where i can put the password?
Code:
Function fRefreshLinks(NewDbName As String) As Boolean Dim strMsg As String, collTbls As Collection Dim i As Integer, strDBPath As String, strTbl As String Dim dbCurr As Database, dbLink As Database Dim tdfLocal As TableDef
I have code that from DB1 opens DB2 and runs a Function in DB2.
The DB2 function produces a Boolean result that i am trying to get back to DB1 without success. Below is the script.
Sub Test22() Dim AC As Object Set AC = CreateObject("Access.Application") rc = "K:ARSHRAutomation_ProjectsMikeFEDB2.accd b" AC.OpenCurrentDatabase (rc) AC.Visible = True AC.Run "SendVariable" End Sub
Because i am using AC.Run "SendVariable" i cant find a way to get the value of SendVariable!!
I want to copy three of my tables from the back end to another database (backup) at regular intervals. When using docmd.CopyObject and docmd.TransferDatabase it is the link that get copied (naturally) and not the table itself.
The goal I am trying to accomplish using VBA within Access 2010 is to append/add certain records to another database (Customer Service) from my database (Client Request). I tried using a macro to append then update records in my database but there is a "lag" time as to when the information is updated in the 'Customer Service' database causing my updates not to occur.
I need to add trim to all text boxes in my database. Any easier way than to add it to the afterupdate event of every text box or a complete list of all trims on buttons that save the records?
I have a number of groups in a particular database. These are based on the month that they relate to, but they are also split into four separate groups for each month. So for example, I will have four groups for November 2014:
November 2014 Raw Data (which contains linked tables in another database) November 2014 (which contains the bulk of the queries that are used for processing) November 2014 Reporting (which are the queries that are used for month end reporting - obviously) November 2014 Misc (anything that doesn't fit into the above, although there are always queries in these groups)
Now, I have been using this database since 2012, so as you can imagine there are quite a significant number of groups. Adding queries to new groups for each new month is therefore starting to take a while by scrolling down to the bottom... Is there a way to do this by using VBA? It would save a bit of time each month.
how do you loop through and insert selected data from a listbox on at a time?For example, lets say you have an insert statement that has a firstname, lastname, CarsID(foreign key) and address field. Lets say you had another table that has ID and CarsID(primary key) field. In the listbox, you have populated it with all the cars and they are selected.
Example:
INSERT INTO PEOPLE(firstname, lastname, CarsID) VALUES('John','Smith','Honda') INSERT INTO PEOPLE(firstname, lastname, CarsID) VALUES('John','Smith','FORD')
I am trying to add extra validation in a sample db (done in A97 (converted to A2003)see attached.
I am attempting the following: Please not that the db has existing validation which I would like to keep (or change if advised) ...
Conditions: 1. Input into field "ID" must start with the letter P or p or R or r 2. If field "ID" starts with the letter P or p and field "Code" starts with the letter R or r, then a message stating that this combination is invalid should appear 3. If field "ID" starts with the letter R or r and field "Code" starts with the letter P or p, then a message stating that this combination is invalid should appear.
Thanks for all your help on my last post, again have a problem to update the application, Everything works well but then I need toadd an extra table on my app. At first I thought I can add a table on my Back-End but when I open the Front-End it wont update.
Can someone out there help me how to add a table on apps. from the ground up?
I have a database for donation collection. So Receipt No's are already printered. I need to add these numbers in my database table with one click. Is it possible? There too much receipt I don't want to add every receipt my self.
In the access form I want to add a button with a special functionality.
After clicking "Select file" button special window should be open (or something else). It should give user a possibility of files locating (doc, pdf, rtf, txt ...).
After selecting the file and confirm the choice in the table "File_location" in database path to the file should be saved .
I have a fe that has 5 tables linked to a backend db on the server.I want to add a new table to the fe that is linked to a second db on the server? What I have tried.I have created the tbl_called in the fe.when I right click on it and go to Linked Table Manager I do not see it on the list. The only tables in the list are the 5 I linked before. Why is tbl_called not showing up??
I have a form where there is just a combobox and a textbox, the user uses the combobox to select the record they want to change and then they enter a value in the textbox which needs to be added to a field in that record.
I get a runtime error "object required" what to do. The textbox is called DeliveryValue and the record I want to add it to is called StockNumber in a table called Products.
I am working with a database that deals with trailers. What is happening is a salesman takes an order for a make and model for a trailer for a customer. The customer can then add some customization to the trailer such as more tail lights or tie down straps. They add the customization on a form called frmCustomQuote. On frmCustomQuote there is a subform called sfQuoteConfigs. On sfQuoteConfigs there is fields such as category and sub catergory that get populated bases on what was selected.
On frmCustomQuote there is a button called "Copy Quote" this will allow the salesman to make an exact copy of the trailer and customization. The quotes are held in a table called tblQuotes and the customization is held in tbQuoteConfigs. Now my problem is when I click on Copy Quote it only copies the first record into tbQuoteConfigs. I can't figure out a way to tell my code to move to the next record within sfQuoteConfigs.
My code:
Code: Option Compare Database Option Explicit 'Setup ADODB connection to the tblQuotes Dim adoQuotesCustomQuote As New ADODB.Recordset 'setup ADODB connection to the tbQuoteConfigs Dim adoQuoteConfigsCustom As New ADODB.Recordset 'Dim the Variables
I have 4 tables: Table1, Table2, TableA and TableB.
Table1 is effectively a master table with Table2 being a sub-table (one to many) with an appropriate linking field (lets call it 'MasterID'). TableA and Table B have the same relationship.
I have a form with Table1 as the source showing a subform listing all related records in Table2. There is a button on the master form that uses AddNew to create a record in TableA based on the data in Table1. I also want the button to add the appropriate number of records to TableB based on the linked records in Table2.
I cannot work out how to select the appropriate records only and add them to the table.
I have a form that the users enter data into and send a report each day. I would like that in a click of a button all the data I entered the day before and that have ="Open" will be entered into the tables with today's date. Is that possible?
I am currently working on an Access Database that houses our security clearance information. Most of the system is up and running but the most recent form has got me spinning my wheels. I have a Word User Form that users will download and complete, once completed the macros will automatically send us the document to be added to our database. Most of this is working the problem is that this portion of the database has multiple related tables and at any given time a user may require multiple records in the related tables. I have created the code to copy most of the information but am getting stuck adding a new record on the sub-form when multiple items are required. Here is a breakdown of the scenario
Word Doc Table 1 = Basic Organization Info Word Doc Table 2+ = Sites to Visit (There could be more than 1 table added here) Word Doc Table 3+ = People to go on site (this might not be the third table based on user interaction for sites)
So far I can get Table 1 and Table 2 data but if there are more than 1 site I cant seem to get the system to create a new record on the related table it is creating a new record on the main form. Here are the lines I used to try to create the related record..
When I put just the above code on a button it seems to have worked as the sub-form showed an additional record was created but when using this on my macro the sub-form is not taking the focus for some reason.
I have a form to add a record to a table. How can I give the user a way to close this form without saving the just created record.
I tried
If me.dirty then DoCmd.RunCommand acCmdDeleteRecord endif
This works, but gives a messagebox in return to confirm the command, and I don't want that. And I try to avoid sendkeys. I also don't want to change the options of access.
I have a form that allows a user to complete a stock take. I would like to stop other users from receiving or despatching stock while a stock take is in progress.
Is there a way I can lock a table, or stop users adding or altering records that match certain criteria. i.e. don't let users receive or despatch stock from with a locationID of 'A'.
Cannot open back end database. There are no other users logged on Tried opening it in open exclusive mode but still error message. Front end on number of desktop PC's. Back End on server. I need to get in design mode on back end but won't let me. I get logon screen but when try to log on get message below I can log onto front end ok.
Error message something like.
* You do not have perimission to open or enable database * You must have open/run open/exclussive administer permissions. * Request other users to log off e.t.c.
I need to take my database 50 miles to a factory site so that an engineer and I can review/modify all the records, ~450 so far.
Can I copy the front end and back end files to my laptop, review edit the data offsite, and then overwrite the back end file on my server when I get back? Are there any issues with doing that?