Add A Record To Subform
Jul 6, 2006
As you can see I have a form with a subform in it. What I want to achieve is that when I press add new record a blank record will popup in the subform without all the other records you currently see. An example of this is the picture under this.
If I then fill in the new record row the record will be added to the main table.
I already tried it for myself but the problem that occurs with my macro is the following:
The macro has the following design:
How can I add a new record without opening the subform?
View Replies
ADVERTISEMENT
Jan 22, 2014
I have two unbound unlinked subforms residing on a 3rd unbound main form. When I enter the current record on Subform1 I would like the matching record(s) on Subform2 to be highlighted or otherwise formatted. I can get this to work for only the first record on subform2 due to the way I have my code setup on Subform1:
Code:
Private Sub Accounting_Unit_Enter()
'find where AUs match. only works for first Subform2 record
If Me.[Accounting Unit] = Forms!MainForm.[Subform2]!AccountingUnit Then
msgbox "Match"
End If
End Sub
My thought was that I needed to reference the Recordset of Subform2 and search for all AccountingUnits that match the current AccountingUnit of Subform1,
View 6 Replies
View Related
Jan 26, 2014
I have two subforms on a main form. Both use similar queries and nearly the same set of records and PK. The first subform is for data entry and the 2nd subform is a continuous form that lists the entries in order that are made from the 1st Subform. (for entering in vacation days and appointments)
The continuous form cannot be edited, it is to be a list for viewing the information only.
I have an edit button next to each record on the continuous form. When the button is clicked, I want it to take the 1st subform to that specific record as well (same PK), so the information can be edited there.
I cannot figure out how to get the 1st subform to go to the record on the continuous form when the button next to that record is clicked on the continuous form.
I tried the DoCmdSearch for record and just keep getting object is not open errors.
View 2 Replies
View Related
Sep 3, 2013
I have two sub forms on a main form.Subform 1 displays information which comes from a query, filtered using two combo boxes on the same form.The active record on the data sheet has two field values output to hidden text boxes on the form.
These text boxes then provide the values used for the query displayed on the 2nd sub form.When I highlight a new record in subform 1, the text box values change, but the values in sub form 2 do no.Which would be the best method to use to get this to requery?
View 10 Replies
View Related
Jun 28, 2013
When we browse through records in a subform we store the records in the database.When we want to delete a records for example the third record from the five records always the first records will be deleted. How can we delete the records where the cursor is at? When we are at the third record and press the delete button the third record from the list in the subform should be deleted.
Code:
Option Compare Database
Dim FocusBln As Boolean
Private Sub Identificeer()
Me.[Datum Aangemaakt].Visible = True
Me.[Datum Aangemaakt].SetFocus
If Me.[Datum Aangemaakt].Text = "" Then
[code]...
View 11 Replies
View Related
Mar 24, 2015
When I add a record in the subform and then move to the next record whilst still in the subform, the main form jumps back to its first record? I then have to move back to the right record in the main form to update the next record in the subform.
I want to move to the next record in the subform without affecting the main form.
View 1 Replies
View Related
Feb 6, 2014
I have a database which has a main form and subform built in linked by parent/child customerid, what i would like to do is search all the subform records from the whole DB and return its parent record on the main form?
Can this be done? because if i use find it will only search the filtered form i have onload of the form?
My onload event is based on fosusername()
View 3 Replies
View Related
Sep 16, 2013
I would like to select a record from my combobox dropdown list and have that record populate in my subform. Currently, I am only able to select the 1st record at the top of the dropdown list to appear in my subform. But I would like to select any record from the dropdown list and have it populate my subform.
View 8 Replies
View Related
Oct 2, 2013
Is it possible to open a form to add a child record related to the highlighted record in the subform?
View 2 Replies
View Related
Jul 6, 2006
Hello All,
I have an ordering db that utilyzes the typical Form / Subform layout. I
would like to be able to delete a record from the Main form and maintain the
same postion relative to the other records. For example, if I am scrolling
through the records and want to delete record #45, After I delete it I would
like to be able to have record #44 visible to the user.
I am currently using (2) SQL statements to delete the records from the main
Order table and the Order Details table which are linked without Cascade
Delete Related Records being on.
I had set-up a recordset procedure to try and find the bookmark set before
deletion but the only way I can get the sub-form to not show a blank form (no
controls visible for the record just deleted and the #deleted in controls on
the main form) is to requery after the delete, which loses the bookmark. If
i place the ReQuery at the end it displays the records properly, (without the
blank record) but returns the record to the first record. I have tried
turning off any sorting references to OrderBy, etc. but it still returns to
the first record.
I have also tried using "DoCmd.RunCommand acCmdDeleteRecord" but it doesn't delete the record from both tables.
Dim rst As Recordset
Dim strSearchName As String
Me.AllowDeletions = True
Me.sfmOrderDetails.Form.AllowDeletions = True
Set rst = Me.RecordsetClone
strSearchName = Str(Me.sfmOrderDetails.Form.txt_Order_No.Value)
rst.FindFirst "Order_No = " & strSearchName
CurrentDb.Execute "DELETE Order_ID FROM tblOrderDetails WHERE Order_ID = " &
Order_ID,dbFailOnError
CurrentDb.Execute "DELETE Order_ID FROM tblOrders WHERE Order_ID = " &
Order_ID, dbFailOnError
Me.Requery
Me.sfmOrderDetails.Form.Requery
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Thanks!
View 6 Replies
View Related
Jul 31, 2015
I am having difficulty getting the right record to carry forward into a modal subform to edit/update information. The Request_nmbr is an autonumber field. The client can have multiple requests. When I open my subform, I can scroll through the records, but when I launch the "update" button, I don't know how to carry forward the request_nmbr so that I'm updating the right record.
Here's my code:
Private Sub Btn_Exception_SubModal_Click()
DoCmd.OpenForm "Frm_Exception_UpdateModal", acNormal, , acFormAdd
Forms! [Frm_Exception_UpdateModal]![Request_nmbr].value = Me![Request_nmbr].value
Forms! [Frm_Exception_UpdateModal]![clientnmbr].value = Me![clientnmbr].value
End Sub
View 6 Replies
View Related
Dec 16, 2014
I am creating an events database. In my main form, I have all the details of a single event (billing code, fees, customer, support personnel, etc.). Then, I have a subform (form view) that lists each of the other services which share an event ID (this ID comes from a separate, unrelated events management suite). In the subform, I display the most-commonly-edited fields so that they are editable without navigating to a different record.
However, there will be instances where it becomes necessary to navigate to one of the records listed in the subform. I would like to make this a quick process by just clicking on the primary key in the subform, and have the corresponding record appear in the main form.
In my searches I've found a common suggestion to use a DoCmd.OpenForm method where the form opens to that specific record -- in effect filtering by the primary key number. I don't prefer this method because it disables the ability to navigate to other records using the previous, next, find records, (etc.) buttons without closing and re-opening the form.
Is there a way to make the main form 'jump' to a specific record by clicking on a control in the subform, without limiting the ability to navigate in the main form?
View 10 Replies
View Related
May 29, 2006
In the zip-file attached below is my "problem" database. (to see the problem open frmLedenArtikels)
On top of the form just select a name from the combo box, the subform then lists the items that person has bought on a certain date. So very easy form.
The problem is the following. When I try to add items to the subform, the record selector in the subform always automatically jumps back to the first record in the subform. this is very annoying and I have totally no clue why this is happening.
View 2 Replies
View Related
Jan 17, 2014
I have a subform with records of call details (date, time, subject) - the date and time are autogenerated and subject is a text field. After entering text in the subject field and then clicking on the close button in the main form, or clicking anywhere else in the main form, the record is saved to the table. However, if I enter text in the subject field and then move up to view previous records (within the subform) and then click the close button in the main form the record is not saved in the table. How can I either save the record before allowing the user to move to another record within the subform or before exiting the subform set the focus to the new record so that it will be saved on exit?
View 4 Replies
View Related
Jun 23, 2015
I have 5 subform named "bene_subform1", "bene_subform2", "bene_subform3", "bene_subform4", "bene_subform5", and i would like to know if it's possible to msgbox the record from the beginning to end of record in sub-form 1, loop thru all the 5 subform via VBA?
View 14 Replies
View Related
Mar 13, 2008
Hi,
im stuck. how can i create a new record on a subform? originally, this was a pop up form and everything worked ok as the new record was set on the pop up form but i have now made it into a subform. my existing code is -
private sub addtherecord()
If Labour.Visible = False Then
Forms![mainform]![MainFormSubForm]![Pay Reg].Value = True
Forms![mainform]![MainFormSubForm]![subform subform].SetFocus
DoCmd.GoToRecord , , acNewRec
end sub
pay reg is a tick box from the table so when it is made true, a new record is set on the subform. there is a sub subform that is updated so i can make many payments to a person based on the above record being created. i need the sub subform to create a new record leaving the subform record unchanged. i can create the subform new record but the current code above creates a new record on the subform not the sub subform.
sorry for all of the subs.....
regs,
NS
View 14 Replies
View Related
Jul 7, 2006
As you can see I have a form with a subform in it. What I want to achieve is that when I press add new record a blank record will popup in the subform without all the other records you currently see.....
View 2 Replies
View Related
Mar 10, 2005
I have a main form with a subform in it and I am trying to goto the next record in the subform. I currently am trying to do this using:
DoCmd.GoToRecord acDataForm, Forms![Processing]("Order Processing").OrderID, acNext
But I always end up getting the error "Object doesn't support this property or method". Could anyone tell me how to goto the next record?
Thanks
Andrew
View 1 Replies
View Related
Jun 27, 2005
I have one form and one subform
form has customer details
subform has customer service records
i would like to know if when the main form is opened at a certain customer
that the subform could display the last service record and a new record
subform is in datasheet view.
also i have a field in the customer details (form) that needs to have the last service date from the subform filled in
can this be done
View 3 Replies
View Related
Oct 20, 2005
I have a subform that I want to automatically go to a new record but I dont want a data entry screen as they need the previous as well.
I've tried putting DoCmd.GoToRecord , , acNewRec on the form open command that doesnt work.. tried it on the onload()..
I thought this was going to be really obvious but after searching the forum I have found others with the problem but no one has given a solution?
Is this not possible?
View 6 Replies
View Related
Nov 13, 2005
Hi,
Is there any way to automatically have a subform only show the Add New Record window?
Basically, I want a form for Data input that will always only show the Add New Record screen without having to hit the >* very time?
I'm struggling through as a bit of a newbie, but after a weekend and a 865 page reference book, I'm making some headway, however this New Record bit isn;t working out very well.
Thanks,
Tim
View 14 Replies
View Related
Mar 17, 2006
I hope this will be an easy question. I have a form which is capturing information about a site visit. Within that is a subform which is linked to a sales table. The main form is a ONE table and the subform is the MANY table. As each property only has one visit a year, but could have many different sales throughout. There is no need for people to look at past sales, just add new sale data.
I would really like the subform to just be blank, ready to add new records. Instead it is showing the already entered records. I know I can add a button to add new record, but I would really just like to have set up to just be ready to add new record.
Thoughts, ideas, solutions.
Thanks.
View 11 Replies
View Related
Aug 12, 2006
I have a subform but when ever i click add new record removes everything listed in the subform and creates a new line.
Is there a way when you click new record all information will still display records but creates a blank line under those records.
View 1 Replies
View Related
Oct 17, 2006
Hi; I have a subform linked with a Main form. Both linked to seperate tables. The subform is in a Single form view. When I try to add new record (via button created with the wizard) ,using just the subform by itself, it works fine. However, when I open the main form with the subform and then try to add the record via the subform i get a message: You can't go to the specified record.
Under the New Record btn this is the code I have:
DoCmd.GoToRecord , , acNewRec
What am I doing wrong?? Do I have to somehow preset the value of the linked field in the subform so it matches the master field?
(I have allow additions, etc.. set properly, since as I said above I can add records just fine when subform is used on its own)
View 2 Replies
View Related
Sep 23, 2007
I'm creating a database to capture contact history to my customers.
I have the customers loaded into one table and that is the souce for my main form. I have an additional table for call history, and have created a subform based onthis table. I have linked the subform via the common key, which is my customer id.
The problem is that the subform will not allow me to create new records in the history table. It will only display _existing_ customer history records. In fact, if there are no linked records in the history table for a particular customer, the subform doesn't even display.
I know that it's probably some silly setting, and I've encounterd this before, but can't remember how I fixed it.
Help would be greatly appreciated!
Thanks,
Eleanor
View 1 Replies
View Related
Nov 24, 2005
Hi guys,
i have a form which has a sub-form on it. each one is bound to a different table. the main form has a one to many relationship with the subform, but every time i try to add a new record to the subform i get an error say that you cant insert a duplicate foreign key.
not sure how to solve that as sql enterprise manager and access do seem to have the option to allow duplicates on the foreign key coloum.
View 3 Replies
View Related