Adding a subform to an existing form

I am trying to add a subform to a form that has an Autonumber primary key. The table already has data in it.
In table view,(ie using no forms) the records are added and displayed correctly. When I use the existing form and the new subform to enter data, the auto increment number does not update on the foreign key field (Linked)on the subform. It seems to have a default value of a random number (28). I was trying to implement this on an existing form that never had a subform before.

Sponsored Links:

Related Topics

Create a subform by using the Subform Wizard
Want to add a subform to an existing form? The Subform Wizard will help you get the job done. You can use an existing form as the subform, or you can have Access create one for you. Watch this five-minute demo to learn how.


Filtering form to display a record only when there are data in the subform
I have a feeling I'm missing the blindingly obvious, but here goes:

I have a form with a subform that work fine together, and are used for comparing imported records (in the subform) against existing data (in the main form). However, sometimes there are nodata in the subform (ie no imported records matching an existing record), in which case I don't need to see the record in the main form at all.

In other words, I only want to see the existing records that might be affected by newly-imported data - only about 30% of the overall records.

Can I filter my main form to show only records that have one or more matches in the subform?


How to alert user of data changed when adding or deleting record in SubForm?
I have a MainForm containg a datasheet SubForm. I want Access to alert user when closing or leaving the record in the MainForm if there is any data change. adding or deletingrecord in datasheet SubForm is considered data change of existing MainForm record.

I applied Me.Dirty function in the Before Update in both MainForm and SubForm to trigger pop up message to alert users for any data change. However, Access does not consider adding or deleting records (rows) in the datasheet SubForm as data change. Therefore, the following codes do not apply.

Can anyone suggests how to make it work for user to be informed when they leave the MainForm if there is any record (row) in datasheet SubForm added or deleted?


Subform Issue
To put it very simply, I have created a form with a subform. The only reason I am using a subform is because I have too many fields and I need a "scroll box" within a set of tabs. I have found no other way to do it.

This method works great except for one scenario: adding records.

I have about 15 fields that I need to display, so the 15 fields are on a subform. The form and subform both reference the same table. The form is linked to the subform on its AutoNumber.

the subform doesn't seem to be linking to the newly created record and I am getting errors when adding values.

The form I am concerned with is called "SAMPLE RECORD." You will see that if you open it, it works like I want it to, but if you click the + to add a newrecord, if you start typing data in the subform I quickly get errors when exiting.


assign variable to existing query as parameter and requey subform
I have a form with a subform on it. The main form has the title and one control (group radio button box) that lets you choose between one of three centre.

The subform lists the members of each centre and the data source is an existing query with member information. The item whose paramater I want to change is the one called "centre" in my query (called "all_members")

I was wondering if there was a way using vba to pass a variable as a parameter to the existing query upon which the subform is based so that when I use me.subform.requery it requeries with the new parameter.

Also how would I clear all parameters from the query using vba so that I can also run it with paramaters as "".

I want to avoid using a drop down or combo box and base the "centre" item in the query on the form control


Color of a subform
I am adding a subform to a form. I am a graphic designer and all my stuff needs to look "designer-ish." I have a nice color scheme worked out in my main form. When I add a subform I seem to be constrained to the default look of the subform, that is to say, it is blue. I want all the design elements of my form to be under my control. A blue subform will not be acceptable. What can I do? I also would like to have control over the way the controls on the subform look, including scroll bars, buttons, etc.


unbound subform requery/new
Have an unbound subform ; it is a continuous form; it is set for Data Entry in its form property.

when the main form first opens is well - the subform is blank; after the user populates some info into the subform - then I need to press a button on the main form and "refresh" the subform to a blank slate.

gotonew record just moves the record selector to the bottom new record - leaving the existing data showing.

other than closing the main form manually - and reopening - - I don't see a way to reset this subform.


Master & Child Link without subform
1st Is possible have Master & Child Link function without adding any subform? If yes, how?

Eg: When I selected a customer "ABC Inc" from a combolist (or many more than 1 field; eg this month,sales man A and etc), all transaction record from table tbltransaction will show me all transactions in a ~*SPLITFORM*~ according what I selected, when I adding new record in the form the table tbltransaction will automatic adding new record including selection(customer ABC Inc,sales man A and etc) I make which like how parent form and subform do between master link and child link.

I did not use subform for this because I unable to add Splitform in a subform,

I try to mimic splitform in 2 subforms(1 single form and 1 datasheet), I can synchronize between single view subform and datasheet subform, but I facing problem when I adding new record and delete record and other few small problems. as my problem is very simple so I hope I can mimic subform function in Splitform, so I do not need to write many VBA code for 2 subforms(1 single form and 1 datasheet) or maybe someone can teach me how to write the VBA code which allow me mimic splitform in 2 subform.


Check for an existing record based on two fields
Is there a way to check for an existing record (by dlookup, or otherwise) before inserting a new record?

I have a table [tblActCouseElements] with two fields; one numeric, called courseID and one text, called element

My form allows someone to select from a list of options, which in turn does an SQL insert into the above table. The possible selections are based in the left subform, the actual selections on the right (see db attached)

I just want to prevent someone clicking, and adding twice.

What's best here


Form Subform DLookup
I have a Form / Subform (with tabs)

On the Subform, I want to:
1. Sum values located on the Form to values located on the Subform.
2. Be able to add a new record for a subsequent Change Order.

The latest attempt has been to display the sum is:

[CODE]

It appears that the sum and the adding of a new record are mutually exclusive. Is my assumption correct?


Subform empty when main form loaded
I have a mainform which contains two subforms

The first subform contains all records from a table and loads perfectly fine when the main form is opened

The second displays a subset of the same records based - a list of records for a selected company ID, this in contrast to the first subform appears blank when the main form opens.

I can manually populate the blank subform by pressing F5, adding a refresh button (uses me.reacalc) and by making the comany ID field a combox and using an after update event that refreshes the form.

I would like the empty subform to populate using the company ID selected when the form is opened (this comes from another form).

I have tried re-calculating the form using several events such as AfterUpdate - but can not get this subform to populate


Sub-Forms and Sub-Reports
A subform (or a subreport) is a form that placed in the body of an existing form (or report). The subform (or subreport) is usually made to show some records. The records of the subform (or subreport) must come from a table, a SQL expression, or a query.


How to requery main form before opening subform.
I have a main form and a subform. The subform displays fields also visible in the main form such as 'Name'. When I click a button on the main form it opens this subform. The problem is this:

Everything works fine with existing records, but when I click a button on the main form, to open up the subform, the Name field in the subform is blank, unlike that of the main form, which has just been filled in. Both forms are linked to the same 'name' field in an underlying table.

So I suspect, filling in the 'name' field in the main form, only updates the underlying table upon closing the main form (or changing the record?). What I want it to do is to update the main table as soon as the name text box has been filled in, in the main form. I hope this is clear


Adding record to subform on exit of main form and no repeat record in subform
I want to add a record to a subform when save a record on the main form, additionally I want the subform to have no repeated record. ie. when people edit a record it wont add another record to the subform on exiting the main form.


Subforms and refreshing data in other subforms from ANOTHER subform....
I have a form with 3 subforms. Subform 1 is for adding records. Subforms 2 and 3 are for editing/viewing records. Since 2 and 3 are essentially identical, we will focus only on subforms 1 & 2 for solutions.

What I want to do is add a record in subform 1, and then be able to immediately view that record in subform 2. However, whenever I add a record in subform 1, I do not see it when I click over to subform 2.


Data Entry Mode in form based on multiple table query
However, I wanted to create an 'add new site' form - triggered by a like-named command button on the edits subform. I did this by making a copy of the whole form, and deleting the subform. I then changed the data entry and additions mode to Yes.

However, when looking at the form in form view, only existing sites are visible. Also, the >* command button in the recordnavigation buttons is greyed out - so there is no way of adding a new record.

I have just discovered (by elimination of all other possibilities) that it seems that this problem is caused by the multiple-table query which posed as the data source for the original form.

When I deleted the linked tables from the data source, so that only the fields from one of the tab controls was now available, and reopened the form, it did indeed open in data entrymode.


Creating a "subform"
I have created a main form and did a drag and drop of another form that is related to it. I establishe the relationship as a one to many between the too. Now when I open the form the main form opens but the "subform" will not. I have tried different things including adding fake data but it still wont display. Can you advise me? I dont want to use the subform view I want to have it in form view


After adding data on subform
I have a main form based on tbl_Prep and a subform based upon tbl_WorkOrder. Not all tbl_Prep records have a related record in tbl_WorkOrder.

My problem is that when a new record is created with data entered on both main and subform upon "leaving" the subform, a blank subform screen is displayed. How can I prevent this from happening? Note that there can only be 1 record on subform to 1 record on main form but I cannot have a 1 to 1 relationship


Main form creates new record; subform doesn't
I have two tables with a one-to-one relationship. I'm using a form and subform to allow the user to enter data. When I test it by adding data in the text boxes on the main and sub forms, I find that a new record is added to the table bound to the main form, but not to the one bound to the subform.

The form and the subform are linked on primary key/foreign key; the primary key for the main form is autonumber, and text boxes on the main form and the subform are bound to fields on their respective tables.

On the main form, Allow Additions and Allow Deletions are set to Yes. The Record Type is Dynaset. These properties are the same for the subform. On the subform, the Enabled property is set to Yes, and the Locked Property is No.


Popup form to add record to subform
I am trying to create schedule for workgroups.
from my subform I need a popup form to enter de data for the client, when I click on the field this form should open to an existing or a new record