Results 1 to 3 of 3
  1. #1
    mab is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    3

    Access 2007 Filtering Forms

    Hi,

    Can someone help? Using an Access form, I'm trying to create a yes/no message box where if the person clicks on "yes" then a form opens and the record source for the form should be "query1". If they click "no" the form should open with record source being "query2". I'm a novice at code and don't know if the form should have a record source in it at all since I want it to change based on "Yes/No".

    ******


    Dim retvalue As Integer
    retvalue = MsgBox("Would you like only active accounts displayed?", vbYesNo")
    If retvalue = 6 Then
    DoCmd.OpenForm "frmNJAcct_addnew", acNormal, "[qryNJAcct_MainInfoOpen]"
    Else
    DoCmd.OpenForm "frmNJAcct_addnew", acNormal, "[qryNJAcct_MainInfo]"
    End If
    ********

    Thanks much.

  2. #2
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Hi,
    This can be achieved something like this:

    Dim retvalue As Integer
    retvalue = MsgBox("Would you like only active accounts displayed?", vbYesNo")
    If retvalue = 6 Then
    DoCmd.OpenForm "frmNJAcct_addnew", acNormal
    Forms!Form.[frmNJAcct_addnew].RecordSource = ("[qryNJAcct_MainInfoOpen]")
    Else
    DoCmd.OpenForm "frmNJAcct_addnew", acNormal
    Forms!Form.[frmNJAcct_addnew].RecordSource = ("[qryNJAcct_MainInfo]")
    End If
    This is an Aircode, I dont have Ms-Access installed here on my laptop, so it's not tested, but you can get some idea.

  3. #3
    mab is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    3

    Access 2007 Filtering Forms

    Thank you much for the assistance.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. 2010 and 2007 Access Queries, Forms & Reports
    By rpaldridge in forum Import/Export Data
    Replies: 3
    Last Post: 02-11-2011, 07:37 AM
  2. Replies: 0
    Last Post: 02-08-2011, 02:34 PM
  3. Replies: 1
    Last Post: 09-15-2010, 07:34 PM
  4. Combo Box Filtering between Forms
    By andrew_ww in forum Access
    Replies: 3
    Last Post: 12-30-2009, 11:06 PM
  5. Replies: 0
    Last Post: 11-17-2009, 02:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums