I am completely unfamiliar with access coding until the middle of last year. I am still not very adept but I have been working on a database for the owner of my company that has gotten much more in depth than anything I have done in access before. I have a main data form called frmDatabaseInfo rmation and other forms that are connect various ways. My example for this question will be my frmAdditionalCo ntacts. These two forms are connect by a 1 to many relationship from the CompanyID fields in each. 1 record in frmDatabaseInfo rmation and possible Many fields in frmAdditionalCo ntacts. I had successfully found code that allowed me to pass the companyID from frmDatabase Information when I clicked a button through the openargs to frmAdditionalCo ntacts. This was imperative so that when a user created a new contact the company id the connected them was copied over. The problem is that I also need to bring over the data from a field called No Work. This is a check box field that when checked in frmDatabaseInfo rmation has code to keep the user from editing that specific record. I need to copy that over to the frmAdditionalCo ntacts for the same reason. I have tried a few ways to transfer the information via openargs but nothing has been successful. I did create a No Work field in the frmAdditionalCo ntacts that is a check box in case that is necessary for me to use the data in the new form.
The following is the code that was working to pass the CompanyID. First the code in the on click function on frmDatabaseInfo rmation:
Next the code in the onclick function in frmAdditionalCo ntacts (If I left it in the onopen event it changed current contacts and I didn't want that)
Thank you so much for any help you may be able to give me!
The following is the code that was working to pass the CompanyID. First the code in the on click function on frmDatabaseInfo rmation:
Code:
Private Sub CmdOpenContacts_Click() If Me.CompanyID > 0 Then DoCmd.OpenForm "FrmAdditionalContacts", acNormal, , "CompanyID =" & CompanyID, acFormEdit, acWindowNormal, Me.CompanyID DoCmd.OpenForm "FrmDatabaseInformation", acNormal, , , acFormAdd End If End Sub
Code:
Private Sub CmdNewRecord_Click() Dim strCompanyID As String strCompanyID = Nz(Form_FrmAdditionalContacts.OpenArgs) Me.AllowAdditions = True If Len(strCompanyID) > 0 Then DoCmd.GoToRecord , , acNewRec Me.CompanyID.Value = strCompanyID End If End Sub
Thank you so much for any help you may be able to give me!
Comment