Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ApplyFilter on a tabbed form

Status
Not open for further replies.

Appollo14

Technical User
Joined
Sep 4, 2003
Messages
182
Location
GB
Hi all,

I have a problem getting a form that uses tabs to display data. The form is called from a command button on another form that is displaying summary information of records in a table. The form should open and display the relevant record based on the id of the record that is selected. The problem is that i have to use the menu and seect applyfilter before the record is displayed. this is the only form in the project that has the problem and i'm guessing it is because all but the id field are displayed on tabs within the form.
I've tried me.refresh, me.repaint, me.requery but they didn't help.

Any suggestions as to where i'm going wrong?

Regards,
Noel.
 
How are ya Appollo14 . . . . .

The ID [blue]doesn't have to be[/blue] on the form, but it [purple]has to be in the RecordSource of the form[/purple].

Is this so?

Post you code for opening the form . . .

Calvin.gif
See Ya! . . . . . .
 
Hi Ace,

The id is in the record source of the form.

Here is the code that i'm using to open the form.

===================================

Private Sub cmdOpenJob_Click()
On Error GoTo Err_cmdOpenJob_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmJob"

stLinkCriteria = "JobId =" & Me.JobId
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenJob_Click:
Exit Sub

Err_cmdOpenJob_Click:
MsgBox Err.Description
Resume Exit_cmdOpenJob_Click

End Sub

===================================

As i said i've got other forms in this project (and others that open and display the data without a problem, however this is the first time ive displayed al data on a tabbed form so i have a feeling i is something perculiar to that.

Regards,
Noel.
 
Appollo14 . . . . .

Your code looks perfectly lagit and should work. At this point I suspect some other code is triggered when the form is opened. See if the [blue]OnOpen, OnLoad, OnActivate, and OnCurrent[/blue] events of [purple]frmJob[/purple] the have any code . . . There's a chance the criteria in DoCmd is overidden here . . .

Calvin.gif
See Ya! . . . . . .
 
Hi Aceman,

Sorry i haven't replied sooner but have bin runnin round in circles all week!

I've checked the form as you suggested and i dont have anything that is trggered in the events that you have mentioned. The only events that do have code behind them are the ondirty and the on keydown. The purpose of this code is ton to stop the user hitting the <esc> key and preventing the user from cancelling without filling in a required field.

Any other ideas?

Regards,
Noel
 
Appollo14 . . . . .

Post the code in your button . . .

Calvin.gif
See Ya! . . . . . .
 
Hi Ace,

Heres the code on the button that opens the form.

================================================
Private Sub cmdOpenJob_Click()
On Error GoTo Err_cmdOpenJob_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmJob"

stLinkCriteria = "JobId =" & Me.JobId
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenJob_Click:
Exit Sub

Err_cmdOpenJob_Click:
MsgBox Err.Description
Resume Exit_cmdOpenJob_Click

End Sub

================================================

Regards,
Noel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top