Results 1 to 4 of 4

Thread: Open Form from number held in another form

  1. #1
    systems013 is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010

    Open Form from number held in another form

    Hi All,

    My first Post so be gentle.

    I have a simple form with one field on display which offers the user a choice of selecting lets say Records 1, 2 or 3. This selection opens a query which loads all the fields associated with the table. From this query I have opened another basic form which has only one field on display which is a unique number based on the initial selection Lets say the number 2.

    I now wish to open a form which is unique to this number 2.

    Here is my humble offerings which fail to deliver.

    Private Sub Job1_KeyPress(KeyAscii As Integer)

    DoCmd.OpenQuery "CompetitionNameQuery"
    DoCmd.OpenForm "GameTypeNoForm"
    If "Forms.GameTypeNoForm.GameTypeNumber" = "2" Then
    DoCmd.OpenForm "PlayersNameQuery"
    End If

    There is something I am missing with the
    If "Forms.GameTypeNoForm.GameTypeNumber" which is defeating me.

    The idea is to be able to have numbers from say 1 to 20 all opening a different form by extending the routine with the "else" command.

    Any help really appreciated.


  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011

    Your reference to GameTypeNumber should be:

    Forms.[GameTypeNoForm].[GameTypeNumber]. (or maybe those should be ! instead of periods, but I don't think it will matter.) If GameTypeNumber is really numeric, then you shouldn't need quotes around the-- 2 ---.
    Having said that, it seems to me that using an option group or list box would be simpler, but I don't have a clear picture of how many tables, queries and forms you have.
    Why not just have the first form select which form to open next and that form would open with the proper query?

  3. #3
    systems013 is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010

    Problem Solved

    Thanks hertfordkc,

    The only thing I hadn't tried was putting the Form and Field in brackets. I have also removed the quote from the number, it works with quotes also.

    This was the last hurdle in creating a series of score entry forms and player selection lists for use with all types of Golf Scoring arrangements. Singles, pairs, team games, leagues and so on. So far as I know knowone has produced such a wide ranging list of scoring facilities. I run a Winter League which has Singles pairs and Mixed hence the requirement to have both seperate scoring but also to have seperate player lists with each having their own handicap. If I ever get it finished it should take the strain out of manually entering results myself and working out winners and League Leaders.

    Many Thanks Again


    Private Sub Job1_KeyPress(KeyAscii As Integer)
    DoCmd.OpenQuery "CompetitionNameQuery"
    DoCmd.OpenForm "GameTypeNoForm"
    If Forms![GameTypeNoForm]![GameTypeNumber] = 1 Then
    DoCmd.OpenForm "PlayersNameQuery"

    ElseIf Forms![GameTypeNoForm]![GameTypeNumber] = 2 Then
    DoCmd.OpenForm "PlayersNameQuery2"
    ElseIf Forms![GameTypeNoForm]![GameTypeNumber] = 3 Then
    DoCmd.OpenForm "PlayersNameQuery3"
    End If
    End Sub

  4. #4
    apr pillai's Avatar
    apr pillai is offline Contributor
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Alappuzha, India
    You can open Forms and Reports by using a simple method. This method also has an advantage of implementing this method easily in your other databases also once you know few basics of it.

    Take a look at the Article on this topic: Opening Access Forms

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

Similar Threads

  1. Replies: 6
    Last Post: 07-25-2011, 12:54 PM
  2. Open form with matching ID Number
    By l3111 in forum Forms
    Replies: 1
    Last Post: 04-15-2011, 06:58 AM
  3. Replies: 21
    Last Post: 02-14-2011, 12:51 PM
  4. Replies: 9
    Last Post: 09-19-2010, 08:18 PM
  5. Replies: 2
    Last Post: 02-26-2010, 06:14 AM

Posting Permissions

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