Results 1 to 4 of 4
  1. #1
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Custom Parameter Form (2000)

    Lost, dazed, and confused.
    (From previous post drifting of original subject <post#=238286>post 238286</post#> )
    Moderator: Please advise if this is proper/improper

    I have a frmLoadBoardDateParameter based on qfltLoadBoardDateParameter. Under txtShConDate1in the query it had criteria (Between() And()). This all worked fine except for the fact that I just couldn't live with the Access defaut parameter form not having an input mask for dates. So, I decided to create my own: frmDateParameters.

    frmDateParameters has two unbound textboxes with short date input masks.
    txtFromDate
    txtToDate

    In qryLoadBoardDateParameter under ShConDate1 is the following criteria:
    Between ([Forms]![frmDateParameters]!][txtFromDate]) And ([Forms]![frmDateParameters]![txtToDate])
    Query type parameters and data type have both been set.

    I just don't get how I would relate frmDateParameters to the query (or if it already is due to the criteria expression) and, thereby, the form it is supposed to create the filter for. It seems to me that it should go in the On Open event of frmLoadBoardDateParameter, as well as on a cmdButton to call the filter again after the frmLoadBoardDateParameter has been opened (so you could change the dates again). Code skills pretty much non-existant (which would explain five hours of error messages); brave soldier, but bloody none the less. What I lack in knowledge I attempt to make up for in perseverance. <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30> Never say die! (What's that? ......Dirt?)

    Any input greatly appreciated.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Custom Parameter Form (2000)

    <pre>// I just don't get how I would relate frmDateParameters to the query
    (or if it already is due to the criteria expression) </pre>

    Yes be setting the criteria expression, you relate the frmDateparameters to the query.

    The next step is to set the Recordsource of the form frmLoadBoardDateParameter to the query qryLoadBoardDateParameter, which its sounds like you have done.

    That is all you have to do.
    When you open the form, (by clicking a cmd button in frmDateparameters) the parameters will be used. Doing it this way you are not using a filter, so you don't need to set a filter, or use the On Open event etc.
    Regards
    John



  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Custom Parameter Form (2000)

    To elaborate on John's reply:

    You shouldn't open frmLoadBoardDateParameter directly. Open frmDataParameters first.

    frmDataParameters should contain a command button cmdOpenForm with its Caption property set to "Open LoadBoard" or something like that, and On Click code as follows:

    Private Sub cmdOpenForm_Click()
    DoCmd.OpenForm FormName:="frmLoadBoardDateParameter"
    End Sub

    This way. frmDateParameters will already be open when frmLoadBoardDateParameter is opened. If you want different From and To dates, you can close frmLoadBoardDataParameter; this will activate frmDateParameters again. Or you can place a command button on frmLoadBoardDateParameter that sets focus to frmDateParameters, using either

    Forms!frmDateParameters.SetFocus

    or

    DoCmd.SelectObject acForm, "frmDateParameters"

    If you wish, you can hide frmLoadBoardDateParameter by Me.Visible = False. Reopening it will make it visible again.

  4. #4
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Custom Parameter Form (2000)

    Hans & John,

    Sorry for the delay (needed some serious shut-eye)

    You might have been really proud of me because I created the exact code you gave me - still didn't work. John hit on the reason why. qfltLoadBoardDateParameter was obviously created to run frmLoadBoardDateParameter, but for some reason I changed it to qryMaster some time ago (don't recall why). At any rate, it works great and thanks for the assist. Good lesson in avoiding assumptions of what might be considered obvious.

    As frmDateParameters is unbound, I assume I could use it when ever I wanted to reference it in the criteria expression?

    Neither of you commented on the change in post, so I'll assume I was correct in doing so.

    Again, thanks for the help.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •