Results 1 to 3 of 3
  1. #1
    MuskokaMad is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Posts
    17

    Closing a Form Problem

    Here is what I am trying to accomplish.

    I have 2 Forms frm_NewCustomerEntry and frm_NewOrderEntry2.

    I want to create a button that allows the user to fill in a new customer's data and then proceed directly to the Order Form with the Customer ID and Store ID (Which CustomerEntry Inherited from the Switchboard) Populated in the new form.

    I have validation rules in both the Table and Form for the same fields as I worried this might be causing the problem. No Joy. Have tried splitting the functions into 2 buttons.

    Button 1: cmdSaveRecord has on the OnClick Event.

    If Me.Dirty Then
    DoCmd.RunCommand acCmdSaveRecord
    Forms!frm_CustomerEntry!cmdNewOrder.enabled = True
    Forms!frm_CustomerEntry!cmdNewOrder.SetFocus
    Else
    MsgBox "There were no modifications made to the current record.", vbInformation, "Invalid Save"
    End If

    Button 2: cmdNewOrder has on the OnClick Event

    DoCmd.OpenForm "frm_NewOrderEntry2", acNormal, , , acFormAdd
    Forms!frm_NewOrderEntry2.cboCustomer = Me.ID
    Forms!frm_NewOrderEntry2.cboStore = Forms!frm_NewCustomerEntry!StoreInfo_ID
    DoCmd.Close acForm, "frm_NewCustomerEntry", acSaveNo



    I get a runtime 3316 error not the validation message.

    Suggestions and Help Greatly appreciated

  2. #2
    MuskokaMad is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Posts
    17
    Bump......

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    This is Code below. Let me explain what I understand from your thread:
    1) You have a Form called frm_CustomerEntry to Enter New Customers.
    2) Now if Data is entered data is Saved and a Command Button cmdNewOrder is enabled and receives focus.
    3) You open a Form frm_NewOrderEntry2.
    4) a ComboBox called cboCustomer=Forms!frm_CustomerEntry!ID

    Now my question "Forms!frm_NewOrderEntry2.cboStore = Forms!frm_NewCustomerEntry!StoreInfo_ID". This oiece of code signifies that a combobox on Form frm_NewOrderEntry2=Form!frm_NewCustomerEntry!Store Info_ID, is this another form frm_NewCustomerEntry is this form open. If this form is not then you cannot close it also.


    "I have 2 Forms frm_NewCustomerEntry and frm_NewOrderEntry2"

    Now above is an extract from you thread. Now you mention that you have two forms
    1. frm_NewCustomerEntry
    2. frm_NewOrderEntry2

    my question is frm_customerEntry should be frm_NewCustomerEntry



    If Me.Dirty Then
    DoCmd.RunCommand acCmdSaveRecord
    Forms!frm_CustomerEntry!cmdNewOrder.enabled = True
    Forms!frm_CustomerEntry!cmdNewOrder.SetFocus
    Else
    MsgBox "There were no modifications made to the current record.", vbInformation, "Invalid Save"
    End If

    Button 2: cmdNewOrder has on the OnClick Event

    DoCmd.OpenForm "frm_NewOrderEntry2", acNormal, , , acFormAdd
    Forms!frm_NewOrderEntry2.cboCustomer = Me.ID
    Forms!frm_NewOrderEntry2.cboStore = Forms!frm_NewCustomerEntry!StoreInfo_ID
    DoCmd.Close acForm, "frm_NewCustomerEntry", acSaveNo

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

Similar Threads

  1. Replies: 2
    Last Post: 03-14-2010, 08:21 AM
  2. Replies: 9
    Last Post: 12-28-2009, 04:01 PM
  3. Print Form problem
    By Stelios Panayides in forum Forms
    Replies: 1
    Last Post: 10-06-2009, 07:06 AM
  4. Queries to Form Problem
    By PnerraD in forum Queries
    Replies: 1
    Last Post: 06-10-2006, 09:13 AM
  5. Form Input Problem
    By alvin in forum Forms
    Replies: 2
    Last Post: 01-12-2006, 09:42 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