Add button to create record into table based on ID

weretiger

Registered User.
Local time
Today, 06:09
Joined
Feb 16, 2015
Messages
10
Hi,

I need to create a button into a form, whereby, when the sub-datasheet form popup, it will display all the records belong to Masterdata and i can add/edit/delete from the datasheet.

for e.g.

ParentID | ParentName
Vic1 | Victor
Nic1 | Nicole

ParentID | Children
Vic1 | Cherisse
Nic1 | Stephen
Vic1 | John


In the main form, it will display the Parent information.
In the main form, i need to create a ADD button, whereby when i click on the ADD button (let assume the main form showing "Victor" Vic1 information), it will display a sub-datasheet form showing the children information for Vic1 Victor only...

I have created the main form and the sub children form. now i cannot pass the parameter "Vic1" ParentID when click the Add button.

Now, when i click the Add button, it will display ALL the children data.
 
Hi

Do you use docmd.openform command to open the sub datasheet form popup?

With this command, you can add criteria to filter the records displayed. For more formation go here
 
Hi

Do you use docmd.openform command to open the sub datasheet form popup?

With this command, you can add criteria to filter the records displayed. For more formation go here
[/URL]

Private Sub cmdAddQtreeForm_Click()
Dim sWHERE As String


sWHERE = "[ServerDB] = '" & Me.ServerDB & "'"

'Open the form
DoCmd.OpenForm "xfrm_Qtrees", acFormDS, , sWHERE
End Sub


I had it work and display only the data belong to the server....

However, when i add record, it does not add the record to the ServerDB instead it added to a "BLANK" ServerDB...

I use the Subform with the form itself, that way i can use the masterlink data .... is DoCmd.OpenForm do that way?

if i use the Subform, in the form it will automatically add in ServerDB so that when i add a new record, it automatically create for that ServerDB....

now i use the Add button, it cannot
 
Last edited:
Why not put the subform in a subform/subreport control? This will maintain the link for you...

Sent from my SM-G925F using Tapatalk

My initial design was a subform in a form, but user want to have a TOTAL count in the form, which i do not know how to have the calculation field in the form as the form is direct link to Table and not Query.

I tried use display using the Control Source to replay the Total from the query within the subform, it just displayed as #Name?

=[qry_QtreeIndividual_Saving_Cal2]![Potential_IndividualSaving]
 
Here are some screenshot..

testDB_1 showing the subform that i used.... i will auto add the ServerDB so that when i add new record, it ties to the ServerDB

testDB_2..... it does not do the auto-populate the ServerDB .... when i add new record, it will add to a "BLANK" serverDB
 

Attachments

  • testDB_1.JPG
    testDB_1.JPG
    33.7 KB · Views: 117
  • testDB_2.JPG
    testDB_2.JPG
    29.8 KB · Views: 118

Users who are viewing this thread

Back
Top Bottom