Hi all,
I am trying to achieve the ability to navigate to another form with a single click, however I want it to go to the same record that it was in previously.
For example:
frmInformation has 500 records
frmDiscipline has 500 records
When I am on frmInformation (249th record) and press the appropriate button it will open up frmDiscipline on the 249th record. I have the above already coded and works well the code I used should anyone need is:
The following will take you from frmInformation to the same related record in frmDiscipline:
Should you require the reverse - frmDiscipline to frmInformation then swap frmDiscipline for frmInformation:
The issue I am encountering is not that when I press on this related record button it does as I have coded and rightfully so - opens up frmDiscipline with the same record that frmInformation is sitting on (filtered). But when I press the same button on frmDiscipline to open frmInformation the form is no longer filtered but is stuck on that one record and there is no way of removing the filter, essentially the recordset has been reduced to 1.
A step by step:
I need a way of letting access know that when I press on the related record button it should open the relevant form in a mode that will allow me to 'clear' the filter. Once the filter is cleared it should then be able to allow me to then select the related record in the first form.
I have tried a few things like setting cases on the click of the related record button:
(strRelatedRecordClicked is loaded with the default value of "Default")
As you can see I end up going around in circles as when the second form opens it does not give me the ability to clear.
To summarise what I wish to achieve:
Yes I can get around the issue by placing everything on one form, but this is a challenge and I refuse to let it beat me (us).
Best regards
Paul
I am trying to achieve the ability to navigate to another form with a single click, however I want it to go to the same record that it was in previously.
For example:
frmInformation has 500 records
frmDiscipline has 500 records
When I am on frmInformation (249th record) and press the appropriate button it will open up frmDiscipline on the 249th record. I have the above already coded and works well the code I used should anyone need is:
The following will take you from frmInformation to the same related record in frmDiscipline:
PHP:
DoCmd.OpenForm "frmDiscipline ", , , "[PrimaryKeyHere]='" & Forms!frmInformation!txtPrimaryKey & "'"
PHP:
DoCmd.OpenForm "frmInformation", , , "[PrimaryKeyHere]='" & Forms!frmDiscipline!txtPrimaryKey & "'"
A step by step:
- Open frmInformation
- Press on the related record button in frmInformation
- Opens frmDiscipline filtered to the same record as in point 1
- Press on the related record button in frmDiscipline
- Opens frmInformation unfiltered but with only the 1 record that was chosen in point 3
I need a way of letting access know that when I press on the related record button it should open the relevant form in a mode that will allow me to 'clear' the filter. Once the filter is cleared it should then be able to allow me to then select the related record in the first form.
I have tried a few things like setting cases on the click of the related record button:
(strRelatedRecordClicked is loaded with the default value of "Default")
PHP:
Select Case strRelatedRecordClicked
Case "True"
DoCmd.OpenForm "frmDiscipline ", , , "[PrimaryKeyHere]='" & Forms!frmInformation!txtPrimaryKey & "'"
strRelatedRecordClicked = "False"
Case "False"
With Me
Filter = ""
btnGoToRelatedRecord.ControlTipText = "Clear Filter"
lblGoToRelatedRecord.Caption = "Clear Filter" & strname
End With
strRelatedRecordClicked = "Default"
Case "Default"
With Me
Filter = ""
btnGoToRelatedRecord.ControlTipText = "Related Record"
lblGoToRelatedRecord.Caption = "Related Record" & strname
End With
strRelatedRecordClicked = "True"
End Select
To summarise what I wish to achieve:
- Open frmInformation tab
- Search for an appropriate record
- Want to see related records in another form (frmDiscipline)
- Press the related record button
- Opens up the other form as a tab (frmDiscipline)
- frmDiscipline loads up with an option to clear the filter (which will unfilter the form)
- Once the filter has been cleared it should then allow the user to press the related record button and go back the ways to the frmInformation tab
- frmInformation will now appear with the clear filter
- So on and so fourth
Yes I can get around the issue by placing everything on one form, but this is a challenge and I refuse to let it beat me (us).
Best regards
Paul