PC Review


Reply
Thread Tools Rate Thread

how to create new record automatically

 
 
Jon
Guest
Posts: n/a
 
      25th Dec 2009
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?

 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      25th Dec 2009
On Fri, 25 Dec 2009 12:27:01 -0800, Jon <(E-Mail Removed)> wrote:

>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.
--

John W. Vinson [MVP]
 
Reply With Quote
 
Jon
Guest
Posts: n/a
 
      26th Dec 2009
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" wrote:

> On Fri, 25 Dec 2009 12:27:01 -0800, Jon <(E-Mail Removed)> wrote:
>
> >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.
> --
>
> John W. Vinson [MVP]
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically create new record Duck Microsoft Access 3 11th Jun 2007 08:49 PM
Create a new record automatically =?Utf-8?B?Q2luZHkgYXQgVFJX?= Microsoft Access VBA Modules 0 8th Feb 2005 02:03 PM
Automatically create record in subform =?Utf-8?B?ZGs=?= Microsoft Access 2 17th Sep 2004 03:37 AM
Create Record Automatically Ken Microsoft Access Macros 3 31st Dec 2003 01:17 PM
create record (in subform) automatically Mats Microsoft Access Forms 3 1st Jul 2003 12:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:09 AM.