Results 1 to 4 of 4
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    Opening a form based on criteria

    Hi



    I have a form which contains 2 combo boxes

    one reveals a drop down list of parishes

    the other reveals a list of the churches in that parish

    The form contains a button whicvh creates two temporary variable and then opens a form.
    Code:
    Private Sub btnSearch_Click()
    TempVars.Add "varParish", Me.cboParish.Column(1)
        TempVars.Add "varChurch", Me.cboChurch.Column(1)
        DoCmd.Close
        DoCmd.OpenForm FormName:="frm_HomeFiltered"
    End Sub
    I need to add criteria so that if the user fails to select either a parish or a church frm_HomeFiltered does not open and a message box pops up to tell them to select a Parish and a CHurch.

    I've tried adding criteria so that if the combo box is Null show a message and I failed at that.

    I then thought of using the existence of a temporary variable as criteria?

    I seem to be digging a big hole, is there a simpler way?

    thanks

    Ian

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps you are looking for something like this
    https://www.accessforums.net/showthr...881#post229881

  3. #3
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    not getting anywhere

    Hi

    been experimenting today and decided to create a macro to acheive my end.

    The form has two combo boxes and a search button.

    The search button created to tempvars and then opens a form.

    I want the macros to either open a message box to say Enter a church ( from a combobox) or open a form.

    I created the macro and it doesnot work.

    I've attached a screen dump as I cant see a way to copy th macros code an post it.

    any help appreciated

    cheers

    Ian
    Attached Thumbnails Attached Thumbnails macros.jpg  

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    If using VBA is not your favorite approach, you may be best served starting a new thread in the Macros forum here at AccessForums.net. Having said that, I believe VBA is the prevalent method used in data validation. There are built in tools at the table level and in various controls that can assist with constraints and work in conjunction with VBA.

    I am sorry to say that I do not understand most Access Macros and they seldom offer me any personal benefit.

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

Similar Threads

  1. Opening a report using criteria from a form
    By craig1988 in forum Forms
    Replies: 4
    Last Post: 08-22-2016, 08:23 AM
  2. Replies: 4
    Last Post: 06-28-2012, 08:01 AM
  3. Replies: 15
    Last Post: 04-17-2012, 01:42 PM
  4. Link Criteria no working when opening new form
    By ETCallHome in forum Forms
    Replies: 1
    Last Post: 06-17-2011, 05:26 AM
  5. Cancel opening a form based on information
    By eww in forum Programming
    Replies: 1
    Last Post: 10-19-2010, 01:24 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