how to create new record automatically

J

Jon

Hi,
I have a form a form to show the customer information and I button to create
new order for him. The Order form has the following fields:
OrderID>>>autonumber
cutomerID
employeeID
….
Also, there is a subform that is bounded on the Order Details table which
has the following fields:
OrderID
ProductID
…..

What I want to do is once the Order form open, I want access to set the
CustomerID value based on the customerID that is on customer form and
generate a new OrderID in order to pick the Product ID from the subform. I
try to set the value for the customer ID field in main form to be dufalted
using the following expression:
=[Forms]![Customer Details/Orders]![CustomerID]

The value is successfully added but when I tried to pick up a product from
the subform , an error message appears as follows:
“ You tried to assign the null value to a variable that is not a variant
data type.â€

Finally, what I want to do is assign & create a new order without entering
customer ID into the order form. Any suggestion please?
 
J

John W. Vinson

Hi,
I have a form a form to show the customer information and I button to create
new order for him. The Order form has the following fields:
OrderID>>>autonumber
cutomerID
employeeID
….
Also, there is a subform that is bounded on the Order Details table which
has the following fields:
OrderID
ProductID
…..

What I want to do is once the Order form open, I want access to set the
CustomerID value based on the customerID that is on customer form and
generate a new OrderID in order to pick the Product ID from the subform. I
try to set the value for the customer ID field in main form to be dufalted
using the following expression:
=[Forms]![Customer Details/Orders]![CustomerID]

The value is successfully added but when I tried to pick up a product from
the subform , an error message appears as follows:
“ You tried to assign the null value to a variable that is not a variant
data type.”

Finally, what I want to do is assign & create a new order without entering
customer ID into the order form. Any suggestion please?

If the order form were a Subform of the customer form, using the CustomerID as
the master/child link field, this would be automatic and would require no code
at all.

If, however, you get even a little bit of return business, you should consider
just having a Combo Box on the Order form to select (rather than typing in)
the customer ID, displaying the customer name and other identifying
information for the user to select the right customer. You can use the "Not In
List" event of this combo to pop up a customer entry form when it's a new
customer.
 
J

Jon

Hi John,
The order for is not a subform for customer form. Customer form is
displaying one particular customer, but if the customer wish to create an
order , he click on a button in the customer form and the order form is
showing. I already add the combo box in form order and I assign its’ default
value to be the customer ID where is taken form the customer form, but the
order can not be created unless I choose the ID from the Combo box. What I
want to do is add the customer ID in combo box with no action from the
customer. The customer is only be able to select the products from the
subform only. I am trying to simulate an online shop


John W. Vinson said:
Hi,
I have a form a form to show the customer information and I button to create
new order for him. The Order form has the following fields:
OrderID>>>autonumber
cutomerID
employeeID
….
Also, there is a subform that is bounded on the Order Details table which
has the following fields:
OrderID
ProductID
…..

What I want to do is once the Order form open, I want access to set the
CustomerID value based on the customerID that is on customer form and
generate a new OrderID in order to pick the Product ID from the subform. I
try to set the value for the customer ID field in main form to be dufalted
using the following expression:
=[Forms]![Customer Details/Orders]![CustomerID]

The value is successfully added but when I tried to pick up a product from
the subform , an error message appears as follows:
“ You tried to assign the null value to a variable that is not a variant
data type.â€

Finally, what I want to do is assign & create a new order without entering
customer ID into the order form. Any suggestion please?

If the order form were a Subform of the customer form, using the CustomerID as
the master/child link field, this would be automatic and would require no code
at all.

If, however, you get even a little bit of return business, you should consider
just having a Combo Box on the Order form to select (rather than typing in)
the customer ID, displaying the customer name and other identifying
information for the user to select the right customer. You can use the "Not In
List" event of this combo to pop up a customer entry form when it's a new
customer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top