If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Both things that you presumed are correct.
As for the filter problem, even if I include only the first line of code (DoCmd.OpenForm "frmPerson", , , "[PersonD]='" & Me.txtPersonID & "'") it still creates a filter. I am not changing the recordsource so I don't understand why this happens. Anyway, since this seems not to be working for me perhaps I should try to use the Bookmark property of the subform, or the DoCmd.FindRecord in my code? Which one should be easier? I am not familiar with the Bookmark property. Thanks, Sergios |
#12
|
|||
|
|||
Sergios,
Can you post back please with the entire subprocedure, so I can get a bit of an idea what you are doing here. All methods rely on identifying the subform record according to the txtQuestionnaireID value on the unbound form, and if this is not working in one case, it probably won't work in another. -- Steve Schapel, Microsoft Access MVP wrote: Both things that you presumed are correct. As for the filter problem, even if I include only the first line of code (DoCmd.OpenForm "frmPerson", , , "[PersonD]='" & Me.txtPersonID & "'") it still creates a filter. I am not changing the recordsource so I don't understand why this happens. Anyway, since this seems not to be working for me perhaps I should try to use the Bookmark property of the subform, or the DoCmd.FindRecord in my code? Which one should be easier? I am not familiar with the Bookmark property. Thanks, Sergios |
#13
|
|||
|
|||
Wouldn't it be easier if I use the Bookmark? That's what I am trying to
do now but I cannot find a way to save the bookmark after the form closes and then retrieve the bookmark when the form re-opens. Thanks, Sergios |
#14
|
|||
|
|||
Sergios,
The bookmark would need to use the value of the txtQuestionnaireID control on the unbound form. -- Steve Schapel, Microsoft Access MVP wrote: Wouldn't it be easier if I use the Bookmark? That's what I am trying to do now but I cannot find a way to save the bookmark after the form closes and then retrieve the bookmark when the form re-opens. Thanks, Sergios |
#15
|
|||
|
|||
What would be the code for the unbound form to save the bookmark and
for the main form to retrieve the bookmark? Thanks again, Sergios |
#16
|
|||
|
|||
Sergios,
As mentioned before, I will need to see more details of your entire subprocedure, and hopefully track down why the QuestionnaireID is not being recognised. -- Steve Schapel, Microsoft Access MVP wrote: What would be the code for the unbound form to save the bookmark and for the main form to retrieve the bookmark? Thanks again, Sergios |
#17
|
|||
|
|||
Well...you asked for it
Snapshot = Questionnaire Individual = Person txtQLSRID = QuestionnaireID txtIndividualID = PersonID Those above are the actual names that I used for my database. Below is my original tested code that takes you back to the person and the first questionnaire. Private Sub cmdSubmit_Click() On Error GoTo Err_cmdMainMenu_Click Dim split_array split_array = Split(Me.OpenArgs, "|") Dim AddSnapshot As Recordset Set AddSnapshot = CurrentDb.OpenRecordset("tblQLSR", dbOpenDynaset) If split_array(1) = "New" Then AddSnapshot.AddNew Else AddSnapshot.FindFirst "[IndividualID] = '" & split_array(0) & "' And [SnapshotDate] = #" & split_array(1) & "#" AddSnapshot.Edit End If If split_array(1) = "New" Then If IsNull(Me.txtIndividualID.Value) Or IsNull(Me.txtCareCoordinatorFirstName.Value) Or IsNull(Me.txtCareCoordinatorLastName.Value) Or IsNull(Me.txtSnapshotDate.Value) Or IsNull(Me.txtTitle.Value) Or IsNull(Me.txtNetwork.Value) Or IsNull(Me.cboEnvironment.Value) Or IsNull(Me.Location.Value) Or IsNull(Me.txtQLSRID.Value) Then MsgBox "All fields are required" ElseIf MsgBox("Add snapshot?", vbYesNo, "Confirm addition") = vbYes Then AddSnapshot!IndividualID = Me.txtIndividualID.Value AddSnapshot!SnapshotDate = Me.txtSnapshotDate.Value AddSnapshot!SnapshotID = Me.txtQLSRID.Value AddSnapshot!EvaluatorFName = Me.txtCareCoordinatorFirstName.Value AddSnapshot!EvaluatorLName = Me.txtCareCoordinatorLastName.Value AddSnapshot!Title = Me.txtTitle.Value AddSnapshot!PlanOfCareDate = Me.PlanOfCareDate.Value AddSnapshot!Network = Me.txtNetwork.Value AddSnapshot!Environment = Me.cboEnvironment.Value AddSnapshot!Location = Me.Location.Value AddSnapshot!Score = Me.txtScore.Value AddSnapshot!Individuality1 = Me.chkIndiv1.Value AddSnapshot!Individuality2 = Me.chkIndiv2.Value AddSnapshot!Individuality3 = Me.chkIndiv3.Value AddSnapshot!Individuality4 = Me.chkIndiv4.Value AddSnapshot!Individuality5 = Me.chkIndiv5.Value AddSnapshot!Integration1 = Me.chkInteg1.Value AddSnapshot!Integration2 = Me.chkInteg2.Value AddSnapshot!Integration3 = Me.chkInteg3.Value AddSnapshot!Integration4 = Me.chkInteg4.Value AddSnapshot!Integration5 = Me.chkInteg5.Value AddSnapshot!Relationships1 = Me.chkRel1.Value AddSnapshot!Relationships2 = Me.chkRel2.Value AddSnapshot!Relationships3 = Me.chkRel3.Value AddSnapshot!Relationships4 = Me.chkRel4.Value AddSnapshot!Relationships5 = Me.chkRel5.Value AddSnapshot!Security1 = Me.chkSec1.Value AddSnapshot!Security2 = Me.chkSec2.Value AddSnapshot!Security3 = Me.chkSec3.Value AddSnapshot!Security4 = Me.chkSec4.Value AddSnapshot!Security5 = Me.chkSec5.Value AddSnapshot!Choice1 = Me.chkChoice1.Value AddSnapshot!Choice2 = Me.chkChoice2.Value AddSnapshot!Choice3 = Me.chkChoice3.Value AddSnapshot!Choice4 = Me.chkChoice4.Value AddSnapshot!Choice5 = Me.chkChoice5.Value AddSnapshot!Opportunity1 = Me.chkOpp1.Value AddSnapshot!Opportunity2 = Me.chkOpp2.Value AddSnapshot!Opportunity3 = Me.chkOpp3.Value AddSnapshot!Opportunity4 = Me.chkOpp4.Value AddSnapshot!Opportunity5 = Me.chkOpp5.Value AddSnapshot!Dignity1 = Me.chkDig1.Value AddSnapshot!Dignity2 = Me.chkDig2.Value AddSnapshot!Dignity3 = Me.chkDig3.Value AddSnapshot!Dignity4 = Me.chkDig4.Value AddSnapshot!Dignity5 = Me.chkDig5.Value AddSnapshot!SelfAdvocacy1 = Me.chkSelf1.Value AddSnapshot!SelfAdvocacy2 = Me.chkSelf2.Value AddSnapshot!SelfAdvocacy3 = Me.chkSelf3.Value AddSnapshot!SelfAdvocacy4 = Me.chkSelf4.Value AddSnapshot!SelfAdvocacy5 = Me.chkSelf5.Value AddSnapshot!Independence1 = Me.chkIndep1.Value AddSnapshot!Independence2 = Me.chkIndep2.Value AddSnapshot!Independence3 = Me.chkIndep3.Value AddSnapshot!Independence4 = Me.chkIndep4.Value AddSnapshot!Independence5 = Me.chkIndep5.Value AddSnapshot!Independence6 = Me.chkIndep6.Value AddSnapshot!Independence7 = Me.chkIndep7.Value AddSnapshot!Independence8 = Me.chkIndep8.Value AddSnapshot!Independence9 = Me.chkIndep9.Value AddSnapshot!Independence10 = Me.chkIndep10.Value AddSnapshot!Joy1 = Me.chkJoy1.Value AddSnapshot!Joy2 = Me.chkJoy2.Value AddSnapshot!Joy3 = Me.chkJoy3.Value AddSnapshot!Joy4 = Me.chkJoy4.Value AddSnapshot!Joy5 = Me.chkJoy5.Value AddSnapshot!Staff1 = Me.chkStaff1.Value AddSnapshot!Staff2 = Me.chkStaff2.Value AddSnapshot!Staff3 = Me.chkStaff3.Value AddSnapshot!Staff4 = Me.chkStaff4.Value AddSnapshot!Staff5 = Me.chkStaff5.Value AddSnapshot!Staff6 = Me.chkStaff6.Value AddSnapshot.Update If MsgBox("Snapshot added. Choose YES to add another snapshot or NO to return to View Data", vbYesNo, "Select Yes/No") = vbYes Then Me.txtQLSRID.Value = "" Me.txtSnapshotDate.Value = "" Me.txtCareCoordinatorFirstName.Value = "" Me.txtCareCoordinatorLastName.Value = "" Me.txtTitle.Value = "" Me.PlanOfCareDate.Value = "" Me.txtNetwork.Value = "" Me.cboEnvironment.Value = "" Me.Location.Value = "" Me.chkIndiv1.Value = "" Me.chkIndiv2.Value = "" Me.chkIndiv3.Value = "" Me.chkIndiv4.Value = "" Me.chkIndiv5.Value = "" Me.chkInteg1.Value = "" Me.chkInteg2.Value = "" Me.chkInteg3.Value = "" Me.chkInteg4.Value = "" Me.chkInteg5.Value = "" Me.chkRel1.Value = "" Me.chkRel2.Value = "" Me.chkRel3.Value = "" Me.chkRel4.Value = "" Me.chkRel5.Value = "" Me.chkSec1.Value = "" Me.chkSec2.Value = "" Me.chkSec3.Value = "" Me.chkSec4.Value = "" Me.chkSec5.Value = "" Me.chkChoice1.Value = "" Me.chkChoice2.Value = "" Me.chkChoice3.Value = "" Me.chkChoice4.Value = "" Me.chkChoice5.Value = "" Me.chkOpp1.Value = "" Me.chkOpp2.Value = "" Me.chkOpp3.Value = "" Me.chkOpp4.Value = "" Me.chkOpp5.Value = "" Me.chkDig1.Value = "" Me.chkDig2.Value = "" Me.chkDig3.Value = "" Me.chkDig4.Value = "" Me.chkDig5.Value = "" Me.chkSelf1.Value = "" Me.chkSelf2.Value = "" Me.chkSelf3.Value = "" Me.chkSelf4.Value = "" Me.chkSelf5.Value = "" Me.chkIndep1.Value = "" Me.chkIndep2.Value = "" Me.chkIndep3.Value = "" Me.chkIndep4.Value = "" Me.chkIndep5.Value = "" Me.chkIndep6.Value = "" Me.chkIndep7.Value = "" Me.chkIndep8.Value = "" Me.chkIndep9.Value = "" Me.chkIndep10.Value = "" Me.chkJoy1.Value = "" Me.chkJoy2.Value = "" Me.chkJoy3.Value = "" Me.chkJoy4.Value = "" Me.chkJoy5.Value = "" Me.chkStaff1.Value = "" Me.chkStaff2.Value = "" Me.chkStaff3.Value = "" Me.chkStaff4.Value = "" Me.chkStaff5.Value = "" Me.chkStaff6.Value = "" Else AddSnapshot.Close DoCmd.OpenForm "frmIndividual", , , , , , [txtIndividualID] DoCmd.Close acForm, Me.Name End If End If ElseIf MsgBox("Submit changes and exit?", vbYesNo, "Edit Snapshot") = vbYes Then If IsNull(Me.txtIndividualID.Value) Or IsNull(Me.txtCareCoordinatorFirstName.Value) Or IsNull(Me.txtCareCoordinatorLastName.Value) Or IsNull(Me.txtSnapshotDate.Value) Or IsNull(Me.txtTitle.Value) Or IsNull(Me.txtNetwork.Value) Or IsNull(Me.cboEnvironment.Value) Or IsNull(Me.Location.Value) Then MsgBox "All fields are required" Else AddSnapshot!IndividualID = Me.txtIndividualID.Value AddSnapshot!SnapshotDate = Me.txtSnapshotDate.Value AddSnapshot!SnapshotID = Me.txtQLSRID.Value AddSnapshot!EvaluatorFName = Me.txtCareCoordinatorFirstName.Value AddSnapshot!EvaluatorLName = Me.txtCareCoordinatorLastName.Value AddSnapshot!Title = Me.txtTitle.Value AddSnapshot!PlanOfCareDate = Me.PlanOfCareDate.Value AddSnapshot!Network = Me.txtNetwork.Value AddSnapshot!Environment = Me.cboEnvironment.Value AddSnapshot!Location = Me.Location.Value AddSnapshot!Score = Me.txtScore.Value AddSnapshot!Individuality1 = Me.chkIndiv1.Value AddSnapshot!Individuality2 = Me.chkIndiv2.Value AddSnapshot!Individuality3 = Me.chkIndiv3.Value AddSnapshot!Individuality4 = Me.chkIndiv4.Value AddSnapshot!Individuality5 = Me.chkIndiv5.Value AddSnapshot!Integration1 = Me.chkInteg1.Value AddSnapshot!Integration2 = Me.chkInteg2.Value AddSnapshot!Integration3 = Me.chkInteg3.Value AddSnapshot!Integration4 = Me.chkInteg4.Value AddSnapshot!Integration5 = Me.chkInteg5.Value AddSnapshot!Relationships1 = Me.chkRel1.Value AddSnapshot!Relationships2 = Me.chkRel2.Value AddSnapshot!Relationships3 = Me.chkRel3.Value AddSnapshot!Relationships4 = Me.chkRel4.Value AddSnapshot!Relationships5 = Me.chkRel5.Value AddSnapshot!Security1 = Me.chkSec1.Value AddSnapshot!Security2 = Me.chkSec2.Value AddSnapshot!Security3 = Me.chkSec3.Value AddSnapshot!Security4 = Me.chkSec4.Value AddSnapshot!Security5 = Me.chkSec5.Value AddSnapshot!Choice1 = Me.chkChoice1.Value AddSnapshot!Choice2 = Me.chkChoice2.Value AddSnapshot!Choice3 = Me.chkChoice3.Value AddSnapshot!Choice4 = Me.chkChoice4.Value AddSnapshot!Choice5 = Me.chkChoice5.Value AddSnapshot!Opportunity1 = Me.chkOpp1.Value AddSnapshot!Opportunity2 = Me.chkOpp2.Value AddSnapshot!Opportunity3 = Me.chkOpp3.Value AddSnapshot!Opportunity4 = Me.chkOpp4.Value AddSnapshot!Opportunity5 = Me.chkOpp5.Value AddSnapshot!Dignity1 = Me.chkDig1.Value AddSnapshot!Dignity2 = Me.chkDig2.Value AddSnapshot!Dignity3 = Me.chkDig3.Value AddSnapshot!Dignity4 = Me.chkDig4.Value AddSnapshot!Dignity5 = Me.chkDig5.Value AddSnapshot!SelfAdvocacy1 = Me.chkSelf1.Value AddSnapshot!SelfAdvocacy2 = Me.chkSelf2.Value AddSnapshot!SelfAdvocacy3 = Me.chkSelf3.Value AddSnapshot!SelfAdvocacy4 = Me.chkSelf4.Value AddSnapshot!SelfAdvocacy5 = Me.chkSelf5.Value AddSnapshot!Independence1 = Me.chkIndep1.Value AddSnapshot!Independence2 = Me.chkIndep2.Value AddSnapshot!Independence3 = Me.chkIndep3.Value AddSnapshot!Independence4 = Me.chkIndep4.Value AddSnapshot!Independence5 = Me.chkIndep5.Value AddSnapshot!Independence6 = Me.chkIndep6.Value AddSnapshot!Independence7 = Me.chkIndep7.Value AddSnapshot!Independence8 = Me.chkIndep8.Value AddSnapshot!Independence9 = Me.chkIndep9.Value AddSnapshot!Independence10 = Me.chkIndep10.Value AddSnapshot!Joy1 = Me.chkJoy1.Value AddSnapshot!Joy2 = Me.chkJoy2.Value AddSnapshot!Joy3 = Me.chkJoy3.Value AddSnapshot!Joy4 = Me.chkJoy4.Value AddSnapshot!Joy5 = Me.chkJoy5.Value AddSnapshot!Staff1 = Me.chkStaff1.Value AddSnapshot!Staff2 = Me.chkStaff2.Value AddSnapshot!Staff3 = Me.chkStaff3.Value AddSnapshot!Staff4 = Me.chkStaff4.Value AddSnapshot!Staff5 = Me.chkStaff5.Value AddSnapshot!Staff6 = Me.chkStaff6.Value AddSnapshot.Update AddSnapshot.Close DoCmd.OpenForm "frmIndividual", , , , , , [txtIndividualID] DoCmd.Close acForm, Me.Name End If End If Thanks, Sergios |
#18
|
|||
|
|||
|
#19
|
|||
|
|||
Hi Steve,
The code i posted here was the code that I used before trying to do any changes. txtIndividualID was in the OpenArgs because this way I could return to the same person after editing him for example. I was using the following code when I was opening the person form: Me.Recordset.FindFirst "[IndividualID] = '" & Me.OpenArgs & "'" Anyway it works now but it's not convenient that a filter is created and I cannot move to another person. I know that you told me I can add a command button to reset the record source but I think that is not very user friendly. Thanks for your help, Sergios |
#20
|
|||
|
|||
Sergios,
Ah! I misunderstood you. I thought you were referring to the Questionnaire subform when you were complaining about the "filter", not the main Person form. Well, you could try an adaptation of the FindRecord code I suggested before, if access to all Person records is what you want. Something like this... DoCmd.OpenForm "frmIndividual" DoCmd.SelectObject acForm, "frmIndividual" Forms!frmIndividual!IndividualID.SetFocus DoCmd.FindRecord Me.txtIndividualID Forms!frmIndividual!Questionnaire.SetFocus Forms!frmIndividual!Questionnaire.Form!SnapshotID. SetFocus DoCmd.FindRecord Me.txtQLSRID DoCmd.Close acForm, Me.Name -- Steve Schapel, Microsoft Access MVP wrote: Hi Steve, The code i posted here was the code that I used before trying to do any changes. txtIndividualID was in the OpenArgs because this way I could return to the same person after editing him for example. I was using the following code when I was opening the person form: Me.Recordset.FindFirst "[IndividualID] = '" & Me.OpenArgs & "'" Anyway it works now but it's not convenient that a filter is created and I cannot move to another person. I know that you told me I can add a command button to reset the record source but I think that is not very user friendly. Thanks for your help, Sergios |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Re-open form showing last record (when using a form with a subform) | [email protected] | General Discussion | 23 | May 2nd, 2005 10:30 PM |
Is it possible to show both "Yes" and "No" answers from a "yes/no" checkbox? | Colin Foster | New Users | 28 | March 18th, 2005 02:19 PM |
Cursor Positioning | Colin Hammond | General Discussion | 3 | November 2nd, 2004 08:42 PM |
Form drops edited record-inserts new record instead | karenk10 | General Discussion | 0 | September 22nd, 2004 10:19 PM |
auto entry into second table after update | Tony | New Users | 13 | July 9th, 2004 10:42 PM |