Dear All,
I'm having problems with a command button linking a form to another.
I have a form CallsLogged.
Which uses the table CallsLogged.
CallsLogged table has the Primary Key of Reference
It has 3 Subforms.
One of the subforms is UpdatesSubform.
Which uses the table Updates.
Updates table has the Primary Key of UpdateNo
The Updates table links to the CallsLogged table via Reference
The relationship between the CallsLogged table and the Updates table is One Call to Many Updates; I have enabled referential integrity.
This works great.
The problem I am having is that instead of creating a subform on the subform updates, no screen space, I want to create a button that will open a form I have already created.
The form is called Attachments
The form Attachments uses the table Attachments
The table Attachments Primary Key is AttachNo
It also has the field UpdateNo
It links to the Updates table via UpdateNo to Updates tables UpdateNo. This creates a One Update with Many Attachments relationship; I have enabled referential integrity.
I want the form to have the UpdateNo field filled in automatically, in accordance with the Update forms UpdateNo.
I have used the button wizzard and used it to display specific information UpdateNo <=> UpdateNo.
This doesn't autofill in the UpdateNo and in fact it is blank or zero with the AttachNo still on Autonumber.
I have also checked when the form Attachments is running after clicking the button.
The Attachments form shows in the Properties: Filter [UpdateNo]=63
And next to the navigation buttons (Filtered)
But still no joy.
here is the code:
I have even tried to create a subform on the UpdatesSubform and then use a button to link to that and that does not work, also used a normal open form button, didn't work.
The Attachment table is empty of course as no attachments have been added yet.
Any help would be greatly appreciated![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Thank you,
Kind regards
Triacona
I'm having problems with a command button linking a form to another.
I have a form CallsLogged.
Which uses the table CallsLogged.
CallsLogged table has the Primary Key of Reference
It has 3 Subforms.
One of the subforms is UpdatesSubform.
Which uses the table Updates.
Updates table has the Primary Key of UpdateNo
The Updates table links to the CallsLogged table via Reference
The relationship between the CallsLogged table and the Updates table is One Call to Many Updates; I have enabled referential integrity.
This works great.
The problem I am having is that instead of creating a subform on the subform updates, no screen space, I want to create a button that will open a form I have already created.
The form is called Attachments
The form Attachments uses the table Attachments
The table Attachments Primary Key is AttachNo
It also has the field UpdateNo
It links to the Updates table via UpdateNo to Updates tables UpdateNo. This creates a One Update with Many Attachments relationship; I have enabled referential integrity.
I want the form to have the UpdateNo field filled in automatically, in accordance with the Update forms UpdateNo.
I have used the button wizzard and used it to display specific information UpdateNo <=> UpdateNo.
This doesn't autofill in the UpdateNo and in fact it is blank or zero with the AttachNo still on Autonumber.
I have also checked when the form Attachments is running after clicking the button.
The Attachments form shows in the Properties: Filter [UpdateNo]=63
And next to the navigation buttons (Filtered)
But still no joy.
here is the code:
Code:
Private Sub OpenAttachments_Click()
On Error GoTo Err_OpenAttachments_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Attachments"
stLinkCriteria = "[UpdateNo]=" & Me![UpdateNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenAttachments_Click:
Exit Sub
Err_OpenAttachments_Click:
MsgBox Err.Description
Resume Exit_OpenAttachments_Click
End Sub
The Attachment table is empty of course as no attachments have been added yet.
Any help would be greatly appreciated
![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Thank you,
Kind regards
Triacona