Results 1 to 7 of 7
  1. #1
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41

    Help....new to access and. Database creates blank records.

    I am working with a couple of forms that are connected by a unique individual number (UNI). Individual Demographics, Order, Placement, Return. Specifically I need help with two forms. The Individual Demographics form lists basic demographic info about the individual the Order form lists order information (a query that joins my demographic and order tables based on the UNI).

    For every order there is an order number (autogenerated by access). On the Individual Demographics form I would like to place a Retrieve Data button to open the Order form to the UNI selected in the combo box of the Individual Demographics form. I added a command button from the tool bar to open the Order form where the UNI’s are equal. This works fine for individuals that have an order but access opens the form to a blank where there is no current record. Is there a way I can code the current button or create a new button to only open the second form if there is actually a record and maybe display a popup to tell the user than there isn’t an order if they don’t have one.

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    Go back to your tables and relationships. Forms are a means of displaying data, but the data is stored in tables. Tables represent the "things" you are working with, and relationships show how those things are related. That's the level you need to understand in order to make forms and buttons do what you want.

  3. #3
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41
    That makes sense. I just don't know how to code the button to display the info I want in the Order form. I looked at the code in the command button for the open form action where the two fields are equal but it does not make sense to me. In general the code should be such that if an order ID exists open the form to the selected record in the first form. I know I need an if statement for the order ID portion but don't know how to execute the code. I've mostly utilized only macros but unfortunately there isn't an efficient one for this.

  4. #4
    mike_980 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    58
    can you not create a query which runs off a button on your Customer form which retrieves orders for that customer?

    docmd.openquery "your query name here"

    in the query criteria box in design view you need the location of the control on the form which holds the autonumber so put all the fields from the orders table in a query then in the field with the autonumber you want to query type:
    [Forms]![name of your customer form]![name of the control the autonumber is in]

    this will query that number and retrieve any orders for that customer, that what you wanted to do?

    also make sure you dont use spaces in any of the names you give to things in access, VB code doesnt like it!

  5. #5
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41
    Yes, this sounds like what I need it to do. I will try it out. The criteria you specified:
    [Forms]![name of your customer form]![name of the control the autonumber is in], the autonumber is for the order ID and is not on the Individual Demographic form. Does this make a difference? Not every individual will have an order.

  6. #6
    mike_980 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    58
    that will work fine, either put the ID number on the form and go to properties for it and select visable and change it to "no" or create a text box bound to the ID number in your table which is set to not visable and use the name of the text box in the criteria

  7. #7
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41
    Thanks Mike!! This worked great. Is there any way I can point them to a form with that query for presentation purposes and in case they wanted to change the information?

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

Similar Threads

  1. Replies: 11
    Last Post: 11-13-2011, 06:57 PM
  2. Blank Records in Table
    By anwaar in forum Access
    Replies: 3
    Last Post: 09-02-2011, 02:18 PM
  3. Form that creates records from a template
    By techaddiction7 in forum Forms
    Replies: 6
    Last Post: 07-20-2011, 05:11 AM
  4. Sorting Blank Records
    By vicky464 in forum Reports
    Replies: 6
    Last Post: 12-29-2010, 10:41 AM
  5. Replies: 4
    Last Post: 12-13-2010, 05:33 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