Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    2

    Red face Unanswered: Problem with SELECT action in form button

    Please, I need help with the following problem:

    I have a system to track orders and invoices. Both are related but may be used independently: an order may have an invoce, and an invoice may, or may not, have a previous order. I have three tables for this: a table for orders, a table for invoices and a table for order/invoice details
    (with a one to many relation in both cases). This table has a field for the order ID and a field for the invoice ID. My problem is that I need users to select an order from a list in a form and then, at the press of a button, populate the invoice table with the order data (this is already done), get the new invoice ID (don't know how to do it) and update the details proper records with the invoice number (all in the same 'click' event), and then open another form with the new invoice filtered and a
    subform with the details (this is also done).
    I've tried executing a SQL statement to retrieve the invoice ID, but it doesn't let me do a SELECT statement to recover it.
    I've tried calling a query, but don't know how to pass it the search parameter to get the proper ID.
    I've tried updating the table during the 'open' event on the invoice form I open afterwards, but the table is already locked...

    Can anyone suggest me a solution?. An example would be very appreciated.

    Thanks in advance,

    Damian

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: Problem with SELECT action in form button

    Originally posted by damianvila
    Please, I need help with the following problem:

    I have a system to track orders and invoices. Both are related but may be used independently: an order may have an invoce, and an invoice may, or may not, have a previous order. I have three tables for this: a table for orders, a table for invoices and a table for order/invoice details
    (with a one to many relation in both cases). This table has a field for the order ID and a field for the invoice ID. My problem is that I need users to select an order from a list in a form and then, at the press of a button, populate the invoice table with the order data (this is already done), get the new invoice ID (don't know how to do it) and update the details proper records with the invoice number (all in the same 'click' event), and then open another form with the new invoice filtered and a
    subform with the details (this is also done).
    I've tried executing a SQL statement to retrieve the invoice ID, but it doesn't let me do a SELECT statement to recover it.
    I've tried calling a query, but don't know how to pass it the search parameter to get the proper ID.
    I've tried updating the table during the 'open' event on the invoice form I open afterwards, but the table is already locked...

    Can anyone suggest me a solution?. An example would be very appreciated.

    Thanks in advance,

    Damian
    Like your problem very specific post in spanish, is better for my.
    Post to an sample base in Access 97 with the problem.
    Saludos
    Norberto

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Problem with SELECT action in form button

    Originally posted by damianvila
    Please, I need help with the following problem:

    I have a system to track orders and invoices. Both are related but may be used independently: an order may have an invoce, and an invoice may, or may not, have a previous order. I have three tables for this: a table for orders, a table for invoices and a table for order/invoice details
    (with a one to many relation in both cases). This table has a field for the order ID and a field for the invoice ID. My problem is that I need users to select an order from a list in a form and then, at the press of a button, populate the invoice table with the order data (this is already done), get the new invoice ID (don't know how to do it) and update the details proper records with the invoice number (all in the same 'click' event), and then open another form with the new invoice filtered and a
    subform with the details (this is also done).
    I've tried executing a SQL statement to retrieve the invoice ID, but it doesn't let me do a SELECT statement to recover it.
    I've tried calling a query, but don't know how to pass it the search parameter to get the proper ID.
    I've tried updating the table during the 'open' event on the invoice form I open afterwards, but the table is already locked...

    Can anyone suggest me a solution?. An example would be very appreciated.

    Thanks in advance,

    Damian
    How do you generate this Invoice ID? Is it AutoNumber?

  4. #4
    Join Date
    Jan 2004
    Posts
    2

    Problem still there...

    Yes, it's an autonumber.
    I've tried several methods and it seems that's imposible to do a SELECT from a button's action...

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Problem still there...

    Originally posted by damianvila
    Yes, it's an autonumber.
    I've tried several methods and it seems that's imposible to do a SELECT from a button's action...
    Since this is an autonumber, you'll have to write out a record in order to get that Invoice ID ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •