Tab Bleeding

keiath
StarLounger
Posts: 73
Joined: 08 Jan 2012, 15:07

Tab Bleeding

Post by keiath »

Two minor problem cant seem to figure

When I add a new field to a tab, it bleeds to the other tabs; ie;- the field show on every tab, how can this be stopped.

And I want to create a report, and have a button on the form to print a report base on the form. But I only want it to print a report based on the form in view

How do I do this, as at the moment when I print a report it prints all the reports

User avatar
HansV
Administrator
Posts: 78461
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Tab Bleeding

Post by HansV »

When you want to add a control to a tab page, make sure that you click on the tab before adding the control. When you move the mouse pointer to the tab page, the interior of the the tab page should be highlighted. It it isn't, you'll add the control on top of the tab control instead of to the tab page.

Let's say you place a command button cmdReport on your Stock Control form, and you want to open a report rptStock and to have it display only the current Stock Code. Create an event procedure for the On Click event of the command button like this:

Code: Select all

Private Sub cmdReport_Click()
    ' Check that the current record has a stock code.
    If IsNull(Me.[Stock Code]) Then
        MsgBox "Please activate a record with a valid stock code.", vbExclamation
        Exit Sub
    End If
    ' Save the record if it has been modified
    If Me.Dirty Then
        Me.Dirty = False
    End If
    ' Open the report
    DoCmd.OpenReport ReportName:="rptStock", View:=acViewPreview, _
       WhereCondition:="[Stock Code]=" & Chr(34) & Me.[Stock Code] & Chr(34)
End Sub
Chr(34) is the double quote character ". The stock code must be enclosed in quotes because it is a text value.
Best wishes,
Hans

keiath
StarLounger
Posts: 73
Joined: 08 Jan 2012, 15:07

Re: Tab Bleeding

Post by keiath »

One again thank you, tab problem solved and I know the report thing will be once I've done it.

Again Thank you for taking the time to help a novice create a complex database , and Thank you for a great site.

User avatar
HansV
Administrator
Posts: 78461
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Tab Bleeding

Post by HansV »

You're welcome, and thanks for your kind words!
Best wishes,
Hans