Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

Validating field within print single record code

Discussion in 'Information Technology' started by Karl H, Nov 7, 2005.

  1. Karl H

    Karl H
    Expand Collapse
    Guest

    Hi,
    This code worked for a while, then stopped. I'm trying to be sure the
    client completes a "Limitation" field called cboLimits, before printing, and
    I have the following code:

    If Me.Dirty Then 'Save any edits.
    Me.Dirty = False
    End If

    If Me.NewRecord Then 'Check there is a record to print
    Msgbox "Select a record to print"
    Else
    strWhere = "[ID] = " & Me.[ID]
    If cboLimits = "" Then
    Msgbox "Enter limitations, if any."
    Me.cboLimits.SetFocus
    Exit Sub
    Else
    DoCmd.OpenReport strReport, acViewPreview, , strWhere
    End If
    End If
    End Sub

    It doesn't seem to be evaluating the cboLimits field, and just prints an
    empty space in the field on the report.

    Am I missing something?

    Thank you,
    Karl
     
  2. Loading...


  3. Karl H

    Karl H
    Expand Collapse
    Guest

    Hi Ofer,
    That worked great. I'll have to read up on what Len means.. Thank you so
    much!
    Karl

    "Ofer" wrote:

    > Just incase the value of the combo is Null and not empty, then try this
    >
    > If Len("" & Me.cboLimits) = 0 Then
    > Msgbox "Enter limitations, if any."
    > Me.cboLimits.SetFocus
    > Exit Sub
    > Else
    > DoCmd.OpenReport strReport, acViewPreview, , strWhere
    > End If
    >
    > --
    > The next line is only relevant to Microsoft''s web-based interface users.
    > If I answered your question, please mark it as an answer. It''s useful to
    > know that my answer was helpful
    > HTH, good luck
    >
    >
    > "Karl H" wrote:
    >
    > > Hi,
    > > This code worked for a while, then stopped. I'm trying to be sure the
    > > client completes a "Limitation" field called cboLimits, before printing, and
    > > I have the following code:
    > >
    > > If Me.Dirty Then 'Save any edits.
    > > Me.Dirty = False
    > > End If
    > >
    > > If Me.NewRecord Then 'Check there is a record to print
    > > Msgbox "Select a record to print"
    > > Else
    > > strWhere = "[ID] = " & Me.[ID]
    > > If cboLimits = "" Then
    > > Msgbox "Enter limitations, if any."
    > > Me.cboLimits.SetFocus
    > > Exit Sub
    > > Else
    > > DoCmd.OpenReport strReport, acViewPreview, , strWhere
    > > End If
    > > End If
    > > End Sub
    > >
    > > It doesn't seem to be evaluating the cboLimits field, and just prints an
    > > empty space in the field on the report.
    > >
    > > Am I missing something?
    > >
    > > Thank you,
    > > Karl
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page