Results 1 to 3 of 3
  1. #1
    ETCallHome is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Location
    Limpopo, South Africa
    Posts
    48

    Wink Passing Data from on Form to Another..


    Hi,

    ET is Calling Home again on the same subject... either I am dumb, but I just cannot seem to grasp how to pass the info on the one form to the other form. This is what I am trying to do.

    1. Table 1... tblMaster with the following field - Record_Id (Autonumber - Primary Key), Building_Name (Text - using Lookup Combobox to populate), Room_Nbr (Number - using Lookup Combobox to populate), Capture_Date (Date) and Capture_Id (Text - using Lookup Combobox to populate)

    2. Table 2... tblSlave with the same fields, except, the Record Id is not an autonumber and primary key only a Number and all the other fields do not use Lookup ComboBox to populate and additional fields like bathroom, room, closet, balcony. The intention here is to take the information from tblMaster and populate the data on tblSlave.

    3. I created a Form called frmMaster and enter the necessary information, but I now want to populate the common info on the two tables. I created the relationship between the 2 tables.

    4. I created a second Form frmSlave.

    5. On frmMaster I created a cmd button using the wizard to open frmSlave. When I use this as is, it opens the frmSlave, but no data is pulled thru. When I change the event on click from embedded to event procedure and write the following code, it give me an error: Compile Error (Warning) Expected: =.

    Private Sub Command66_Click()
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "FrmSlave"
    stLinkCriteria = "Hotel_Name =" & Me.Hotel_Name
    DoCmd.OpenForm(stDocName,acNormal, , ,acFormAdd, ,StLinkCriteria)
    End Sub

    Even though it is a warning, it does not even open the frmSlave when I use the code.

    Please bear in mind that I am a novice when it comes to Access development, but a very knowledgable developer in Natural Adabas/Construct and Cobol and Cobol/CICS... yes! I am a legacy systems analyst and fully understand how the logic works with RDBMS. I can create tables and its relationship... queries, forms, reports.

    IF what I am trying to do is not the way to go then can some please help me... you never know, you may need assistance in the programming language that I have over 20yrs experience in... so common guys/gals... help this old man...

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Make these changes to your code:
    stLinkCriteria = "Hotel_Name ='" & Me.Hotel_Name & "'"
    DoCmd.OpenForm stDocName, , ,stLinkCriteria
    ...and see what happens.
    You are *not* using Lookup Fields are you? http://www.mvps.org/access/lookupfields.htm

  3. #3
    thhui is offline Competent Performer
    Windows XP Access 2002
    Join Date
    Feb 2009
    Posts
    235
    Perhaps you should buy a book or have some tutorial lesson on vba on access first.

    Take a look on this website to have a proper understanding of
    DoCmd.OpenForm and its options

    http://www.datawright.com.au/access_..._arguments.htm

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

Similar Threads

  1. Passing Data From One Form to Another Form
    By ETCallHome in forum Forms
    Replies: 6
    Last Post: 03-12-2011, 12:53 PM
  2. Form not passing data to query
    By bobfin in forum Queries
    Replies: 13
    Last Post: 08-11-2010, 05:28 AM
  3. Passing Data with OpenForm
    By nkenney in forum Forms
    Replies: 1
    Last Post: 10-26-2009, 11:40 AM
  4. Passing Parameters to a Data Access Page
    By stevie6410 in forum Access
    Replies: 0
    Last Post: 10-01-2009, 09:14 AM
  5. Passing data to sequential form fields
    By jeepfamilyva in forum Forms
    Replies: 0
    Last Post: 06-28-2009, 11:04 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
  •  
Other Forums: Microsoft Office Forums