Forms :: Linked Tables - New Records And Sub Forms
Dec 12, 2013
I'm developing a system which uses linked tables (to an Oracle database) and subforms. I'm trying to add functionality to create new child records, but am running into errors when saving these records.
Parent table is PATIENT, child is DIAG. I have my DIAG Form_Current event set up to detect whether a record is new. When this happens I populate the DIAG foreign key with the relevant PATIENT primary key, and run a query to the underlying database to find out the next DIAG primary key. I then populate all the necessary fields.
On attempting to leave this record however, I get an ODBC call failed error, telling me that the the primary key constraint in the database has been violated. The reason is that Access isn't saving the record to the underlying database. I've tried to prompt this using Me.Dirty and RunCommand acCmdSaveRecord, but both of these just generate type mismatch errors.
What am I missing? Is there some particular set up for linked tables and creating new sub-records that I need to put in place?
I have three linked tables [Regulator], [RuleBook] and [Rules] (each has a corresponding form for data entry).
In the "Rules" form, when you select name of the regulator, the rule books dropdown down is filtered to show only the rulebooks for that regulator. the code I use is:
Private Sub Regulator_Change() Me.[Rule Book].RowSource = "SELECT [ID],[Rule Book],[Short Code],[Regulator],[RegName],[Short Form],[Active] FROM" & _ " [RuleBook] WHERE Regulator = " & _ Me.Regulator Me.[ShortReg] = Me.Regulator.Column(3) End Sub
Basically, if I select the FSA as the regulator, The Rule Books drop down is filtered to only show the FSA Rule Books. If I pick OFT, I get the OFT list etc. This all works fine.
In the [RuleBook] table, each entry has a yes/no tick box called "Active".
The reason for this being that the regulators change their rule books quite regularly, but from an audit perspective, I can't delete or overwrite the old ones once they are no longer valid.
What I want to do, is further filter the rule book list to those where Active=True so that when I select FSA, I can only choose from their current rule books and not the ones that are no longer relevant.
I have form with an unbound combo box which is populated from a query
It should populate a field in a table which is related to another - however it only works when i query by id number (primary key) and not the text value i want - is it possible to query both so it returns say 1,option 1 - then when selected it will place a 1 in the table - which is related to option 1 in another table instead of just having to select '1' which will mean nothing to a user?
Hi all, I've got one question again. Let's say. I've created several tables to store data for several categories.Note: there is no relationship between each table.In each table, there is the date field in which the record is created. Then I want to make another daily record form that is to find records from all categories which is created at the current date. Is this possible to search records from various tables and combine them to show in one form or report? Can anyone help me in this case? thanks in advance.
I'm new to Access2007. I created 5 tables all related to each other in series with one-to-many joins (type 2 and all enforcements on).So an Id in table 1 can show up several times in table 2, and the same is true from tables 2 to 3, 3 to 4 and 4 to 5.I want to enter new records in such way that I can see all tables at once. I tried to do that with a query, but I can only modify records, not add new ones.I have no problem adding records to individual tables but have not figured out how to do it to this All-tables query.
I have a lot data to append to ODBC linked table in MS Access. I want to know that which way is faster to append the records.
if I append the data into ODBC linked table, 1) create the one query (append) to insert the records into ODBC linked table 2) use the VBA code (DAO/ADO) to insert the records into ODBC linked table
i have an unbound form with the following code which works as it should
Code: Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("tbl_Courses", dbOpenDynaset) With rst .AddNew rst!DateCreated = DateCreated rst!Originator = Originator
[code]....
I also need to add other text fields from the unbound form to another table but can't seem to work out how to do it.
I am running access 2007 in Win7. I have a time sheet application that I wrote many years ago. Within same I have a button to press to open a new form to enter time sheet data. The data for the form comes from a query that links Employee and the Timesheet history data file.In an effort to upgrade and make the application more portable and available to multiple users, I decided to migrate the data tables to a Microsoft SQL 2012 database. Various Access reports based on the SQL database run ok. But if I try to open a form to add a new record I get the following error message:- "Run-Time Error '2105' You can't go to the specified record."
If I debug the error it shows:- Private Sub Form_Open(Cancel As Integer) DoCmd.GoToRecord , , acNewRec End Sub
In an effort to make sure the original time sheet form load worked ok on the original tables, I changed the query to feed off tables in the local Access program and have no issues. It works perfectly. Also if I open the Timesheet Query that feeds the form I can add new records.However if I change the Query to look at the same tables on the SQL database I cannot add records. I can search all records from first to last but not add a record into the query. The add record arrow is greyed out on the query results.
I have a database with a number of linked tables that are linked to tables in different databases (not a back-end).for example, I have table1 that is linked to table1 in K:databasedb1.mdb.table2 linked to table2 in S:datadata.mdb.and so on...
However, recently we have moved all our databases to a new location.
K:databasedb1.mdb is now residing in O:masterdatabase and S:datadata.mdb is now residing in O:masterdata and so on...
I'm now in charge of relinking all those tables to point to the new location.I would do this in linked table manager one by one but we have 100s of tables linked to multiple different databases in different location.is there a way to create a VBA code that will automatically do this re-linking process?
so, 1. find unlinkable tables 2. search its new location under O:master 3. re-link it to the new location
Database names and tables names have not been changed. Just the location of databases.
I have a bound continuous tabular form,However, based on data content in one field of a record, I want a checkbox in the same record enabled, so the user can check it if necessary. I have created a record set using the form as shown below, and I am looping through each record. To show that my code is referring to the field with required data content, I display it as a message box and it works, yet my checkbox does not enable.
I have the code in the form_load event, however, for testing purposes I have it behind a button.If I am seeing this properly, the code behind the button enables the checkbox for ALL records once the criteria in the required field is true, and based on the last record, which has no data content, it disables the checkbox in ALL records. I also have the PK ID for each record hidden in the form. Can I utilize that to target the checkbox of each individual record??
Form Detail -Form does not allow additions or deletions. Edits allowed -All fields are disabled and locked -I only want the check box to unlock if data is found in the "RequiredField" as referred to below. I have also tried if not isNull(requiredfield.value) then -enable checkbox, which yields the same results
Here is my code
Code:
Dim rstMyForm As DAO.Recordset Set rstMyForm = Forms!MyForm.Form.Recordset rstMyForm.MoveFirst Do While Not rstMyForm.EOF If Not RequiredField.Value = "" Then
I have a database containing two tables which are related through the Staff ID number.
The first table Staff information is related with a 1:* relationship to the bookings table.
I.e. one member of staff can book many courses.
I have created the forms based on these tables using the wizard provided in Access 2003. Mid-way through the Wizard I used the option to LINK the forms.
When you open the Staff Information form you have a button which says "Bookings". When you access the bookings form you are provided with a listing of the courses the staff have booked onto.
My problem is that if I add any records to this bookings table they are added; but to an incorrect staff record i.e. not the filtered record from the staff Information table. How do I get added bookings to 1) Be retained 2) Be retained within the filtered record already selected?
Please HELP!
Thanks for reading and sorry if this all seems a bit vague - not great with terminology x
Hi all, hope someone can be of help with this one. Doing a database for a pet minder and have chosen to use linked forms for a more user friendly interface. The problem I have is that when I enter data on the Animal Details subform relative to an owner it is not updating such that when I examine that owners record again the animal details have not been saved. i have enclosed the database please could someone have alook and point out the noob error I am making :o
Does it make a big differance in the size of your database if you have all the images in the forms and reports linked instead of embedded? I have about 15 reports all with graphics and and about 7 forms with graphics also... Just wondering if it would make a big difference if after I split the database and create a folder with the current graphics and just link them all.. Or would that be a waste of time...?
I have a form that launches a query. The results are displayed in a continuous form called ParentForm. On the ParentForm is a combobox which selects a singleform called a ChildForm that displays the details of the selected record. I placed a command button on the ChildForm. This button simulates a circular triple state toggle switch. By clicking this switch the form goes from ReadOnly to Edit to Add modes. The form properties AllowEdits , Allow Additions and DataEntry are adjusted accordingly. These properties when they are changed seem to initiate requery of the underlying data source. Here is the code. I am looking for a way to avoid requery of the data when the mod is changed.
Code: Private Sub ModeBt_Click() '------------------------------------------------------------------------------- ' Circular toggle button to change display mode of the form ' ReadOnly - Edit - Add '------------------------------------------------------------------------------- Select Case Me.Mode Case "Edit Mode" Me.AllowEdits = False
I am a girl guide leader trying to make a faster way to keep track of my unit's completed badge and program work. I have made tables for every area I need (I started with one table but it was too large to change into a form).
In total I have:
- Basic Member table (main information like their name and how many years they have been in, whether they are still in the unit, etc) - Program area tables - Interest badge tables
What I want to do is be able to "add/edit" members from the main form, then go to all the sub forms for their program and badge work -- problem is, how to link them!
i linked the booking to the driver using the ids through the bookingdrivertable.
the italic fields are the ones i have included in my Query called "bookingdriverquery"
bookingtable booking id (autonumber) date (date/time) time (date/time)
drivertable driver id (autonumber) name (text)
bookingdrivertable booking id (number) driver id (number)
after doing this i created a form using the wizard, choosing all the fields from the "bookingdriverquery"
when i opened my form, i hid the booking id and driver id (as they are autonumbers anyway)
i then added a date.. a time.. and a driver name.. pressed save..
the booking table had 1 record, the driver table had one record.. and the bookingdrivertable had 1 record (both the ids)
this is the outcome i wanted..
i would however like to use the booking id and link it to another table in the same way.. a customer table for example (using booking id and customer id)
i had trouble however doing this.. because to duplicate this above method means that my user will have to re-enter the same booking details on another form.. and then the customer details..
how can i link all this together.. if someone wishes ask me a question and i will try to explain.. someone help me please.
I have two forms linked by a field "JUVIS". My problem is that I can't get the second form to show data newly entered on the first form without moving to another record on the first form. I have a command button on the first form that opens the second form. All works well, meaning the forms are synchronized,based on the JUVIS field, except in the case of entering new data. In this case the second form opens to a blank screen instead of showing the JUVIS field. The forms are both linked to tables not to queries. Any help would be appreciated
i have a combo box in a form, where one has to select a country for example UK is chosen, then there is a button that when clicked it opens in a pop-up form and displays all the information related to UK.
so there are two tables : Country (CountryNo : primary key) linked to CountryInfo (CountryNo: foreign key) linked with a one- to -many relationship.
my problem is when you have to add new records to the form CountryInfo, how can i make the foreign key update automatically? thus when adding data to CountryInfo, the CountryNo must be the same to the CountryNo in the CountryTable..
I was recently asked to use access to create a data entry system for coders when they are coding videos. I was asked to create forms that only used fileds from one table of a set of linked tables. I need the tables linked with referential integrity so that I can combine all this information in a useful way later, however whenever I try run my forms, except for the first form that connects to my "master table", all of the rest that need to link to it give me an error message about an inability to maintain referential integrity.
Is there any way that I can have access treat my forms to all be a sequence. What I mean is that if I had a single form with all of the fileds from every linked table, there wouldn't be a problem with integrity since all the changes are simultaneous. Is there a way I can have access treat all of my individual forms as one whole so it deals with the data in a similar way? Thank you in advance to anyone who can help me!
I have a form "article" with a button "place an order". Click on the button opens another form ("order") where I should fill the order for the current article.
The problem : how can I tell to "order" form that I want to order the article I was on in my "article" form, and not another one ?
I have an input form where all the data entered gets transferred to a single table. I also have a report created so I can print it off and view whatever information has been entered onto the form
At the moment when I go to view the report it is showing every record that I have previously entered using that form but I want it to only show the record I am currently entering.
The record source for the report is the table where the data is being stored.
Is there a way in which i can link three drop down boxes together?
I'll create an example of what I mean...
I'll attach a Excel file which contains two identical filters, one of them where the filter is turned on.
If I select the "Serviced" filter, I am left with three options for "Make" and two options for "color". If I select the "color" as "White" I am left with just one "Make" - "MG".
I understand that some sort of "hierarchy" needs to be in place so I will Make it so that "Serviced" Must be entered first, then "Color" then "Make" so that if you select a different "Service", the "Color" and "Make" will repopulate with the appropriate values.
This is certainly possible with a REDICULOUS amount of coding that would map each value to its corresponding values however is this possible some other (easier) way?