Clearing combo box

G

Guest

I am using the following code to open Form FrmJobs2 and go to a specific
record.

Private Sub txtInvNo_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = "[Jobid]=" & Me.txtJobID
stDocName = "FrmJobs2"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
DoCmd.Close acForm, "FrmCollections", acSaveYes
Me.Requery
End Sub

If I then want to select a different job from the combo box on that form
(all jobs are listed), it does not let me select a different job. How can I
clear the "stLinkCriteria".
Thanks,
 
R

ruralguy via AccessMonster.com

The WhereCondition argument (your stLinkCriteria) applies a filter to the
next form. I prefer to pass the ID in the OpenArgs and use the OnLoad event
of the next form to locate the record with FindFirst.
I haven't tried it but maybe:
Me.FilterOn = False
Me.Filter = ""
will clear the filter.

I am using the following code to open Form FrmJobs2 and go to a specific
record.

Private Sub txtInvNo_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = "[Jobid]=" & Me.txtJobID
stDocName = "FrmJobs2"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
DoCmd.Close acForm, "FrmCollections", acSaveYes
Me.Requery
End Sub

If I then want to select a different job from the combo box on that form
(all jobs are listed), it does not let me select a different job. How can I
clear the "stLinkCriteria".
Thanks,
 
G

Guest

I did not realize that this code was creating a filter.
Me.Filter = ""
did the trick
Interesting that you mention the openArgs to pass the ID on in the onload
event of the next form. That is probably the solution to my next problem. It
will put that into a new post. I try to work it out myself first.
Thanks

ruralguy via AccessMonster.com said:
The WhereCondition argument (your stLinkCriteria) applies a filter to the
next form. I prefer to pass the ID in the OpenArgs and use the OnLoad event
of the next form to locate the record with FindFirst.
I haven't tried it but maybe:
Me.FilterOn = False
Me.Filter = ""
will clear the filter.

I am using the following code to open Form FrmJobs2 and go to a specific
record.

Private Sub txtInvNo_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = "[Jobid]=" & Me.txtJobID
stDocName = "FrmJobs2"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
DoCmd.Close acForm, "FrmCollections", acSaveYes
Me.Requery
End Sub

If I then want to select a different job from the combo box on that form
(all jobs are listed), it does not let me select a different job. How can I
clear the "stLinkCriteria".
Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top