Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help with Access database

Options
  • 02-12-2008 3:25pm
    #1
    Closed Accounts Posts: 201 ✭✭


    Hi,

    I have been asked at work to put together an access database. It will be used for purchase orders. I am OK with database and can do the basics.

    i have the bones of the database put together and now am tweaking it to automate some of the processes. I am having difficulty with 1 aspect of a form at the moment. I want to automatically populate fields in a form based on the results of a query.

    I am hoping that someone would be willing to take a quick look at the database and then I could tell them exactly what is not working for me?


Comments

  • Registered Users Posts: 2,598 ✭✭✭Saint_Mel


    Set the RecordSource of the form to the required query, every time the form is opened then it will show the results of the query.

    Or, if you want to display certain records based on selected criteria you can use a combo box to choose the selection criteria
    and then have a subform for the results. Set the RecordSource of the subform to the query, making sure that the WHERE clause incorporates combo box selection ... then in the AfterUpdate event of the combo ... issue a Requery to the subform


  • Closed Accounts Posts: 201 ✭✭sparkite


    Saint_Mel wrote: »
    Set the RecordSource of the form to the required query, every time the form is opened then it will show the results of the query.

    Or, if you want to display certain records based on selected criteria you can use a combo box to choose the selection criteria

    I have done this. I only show 1 column of the results, and the other columns are hidden. I want another field to pull a value from a corresponding column from that query - I have hoped to use a control source of the field to be something like =[names of combobox].[column(2)] but this is not working for me


  • Closed Accounts Posts: 201 ✭✭sparkite


    I'm pretty sure that there is just something small I am missing here.

    I am getting the error message "the object doesn't contain the automation object 'column(1)'


  • Moderators Posts: 51,799 ✭✭✭✭Delirium


    sparkite wrote: »
    I have done this. I only show 1 column of the results, and the other columns are hidden. I want another field to pull a value from a corresponding column from that query - I have hoped to use a control source of the field to be something like =[names of combobox].[column(2)] but this is not working for me

    Should be =[names of combobox].[column](2)

    If you can read this, you're too close!



  • Registered Users Posts: 2,598 ✭✭✭Saint_Mel


    In VBA you can get the value from ComboBox.Column(0)

    Maybe set the source through a VBA procedure/function

    sRecorsdSource = "SELECT * FROM table WHERE ID = " & ComboBox.Column(0)
    Form_Form1.RecordSource = sRecordSource

    DoCmd.OpenForm "Form1"


  • Advertisement
Advertisement