Passing Combo box value to another form (1 Viewer)

Bob M

Registered User.
Local time
Today, 00:57
Joined
Sep 11, 2002
Messages
42
I have a combo box on a subform. When I enter a value in the combo that is not part of the list I want to launch another form where the user enters the new product. I would like to capture the value entered and pass it to the next screen so the user doesn't need to enter it twice.

Since the value I want is defined as the second column of the combo box which has 4, I came up with the following code and placed it in the onenter event for the field on the entry form:

Me.VendorProductNo=Forms![Purchase Orders]![Purchase Orders Subform].Form![ProductID].Column(1)

I get the error that I cannot assign a value to the item.

My question is how do I reference the combo box on the subform and assign it to the field on the entry form?
 

WayneRyan

AWF VIP
Local time
Today, 05:57
Joined
Nov 19, 2002
Messages
7,122
Bob,

Make the default for VendorProductNo:

Code:
=Forms![Purchase Orders]![Purchase Orders Subform]![ProductID].Column(1)

As for the error, VendorProductNo is not an Autonumber
field is it?

Wayne
 

Bob M

Registered User.
Local time
Today, 00:57
Joined
Sep 11, 2002
Messages
42
Combo Box

The VendorProductNo is not an autonumber. I tried putting it in the rowsource to no avail.
I should mention that I have a brforeupdate procedure that does a Dlookup on the Prodcts table using VendorProductNo. I tried assigning this value to Me.VendorProductNo just before doing the Dlookup to no avail. The VendorProductNo field stays blank as though it isn't being passed properly from the subform.
 

WayneRyan

AWF VIP
Local time
Today, 05:57
Joined
Nov 19, 2002
Messages
7,122
Bob,

Do you have the Master/Child links specified?

Wayne
 

Bob M

Registered User.
Local time
Today, 00:57
Joined
Sep 11, 2002
Messages
42
Passign Combo Box value

Wayne

No, I don't.


Bob


From the land of the frozen chosen
 

WayneRyan

AWF VIP
Local time
Today, 05:57
Joined
Nov 19, 2002
Messages
7,122
Bob,

If you can, compact it, ZIP it, and post it.

Wayne
 

Bob M

Registered User.
Local time
Today, 00:57
Joined
Sep 11, 2002
Messages
42
Passing Combo box value

I can zip it but I don't think I can compress it. The entire database zipped is 1.7mb.
 

WayneRyan

AWF VIP
Local time
Today, 05:57
Joined
Nov 19, 2002
Messages
7,122
Bob,

Tools --> Database Utilities --> Compact

Then ZIP.

Wayne
 

Bob M

Registered User.
Local time
Today, 00:57
Joined
Sep 11, 2002
Messages
42
Passing Combo Box Value

Actually I have Access 2002. The utility is compact and repair. I did that then zipped it and it's still 1.5mb.
 

WayneRyan

AWF VIP
Local time
Today, 05:57
Joined
Nov 19, 2002
Messages
7,122
Bob,

Then you're going to have to remove some data, reports etc.

Then compact/repair, ZIP and post.

Also, If you can save it as An A2000 or A97 db it would be
better.

Wayne
 

Bob M

Registered User.
Local time
Today, 00:57
Joined
Sep 11, 2002
Messages
42
Passing Combo Box Value

I have deleted a whole lot of data from all tables and gotten rid of everything that was not essential to the system. I converted it to Access 2000, compacted it and zipped it and it's still 1.5mb.
 

Bob M

Registered User.
Local time
Today, 00:57
Joined
Sep 11, 2002
Messages
42
Passing Combo Box Value

I have stripped down the database to it's bare minimum. It is now compacted and zipped down to 256k. The maximum for posting attachments here is 102k. Is there any way I can e-mail this to you directly.
 

WayneRyan

AWF VIP
Local time
Today, 05:57
Joined
Nov 19, 2002
Messages
7,122
Bob,

Sorry, I've been away a few days. My email will
put it in quarantine.

Do you have any graphics in your app? Even
deleting your tables wouldn't be that bad.

Wayne
 

Bob M

Registered User.
Local time
Today, 00:57
Joined
Sep 11, 2002
Messages
42
Passing Combo Box Value

This is hopeless. I've deleted everything except the form, subform and entry form and the zipped file is still 179k. I've also stripped the form of everything except the opjects needed to see the problem.
 

KevinM

Registered User.
Local time
Today, 05:57
Joined
Jun 15, 2000
Messages
719
Have a look at the attached txt file taken from the Access KB (couldn't find it on the MS web page).

It gives two examples of adding records to a combo box when 'Not In List'
 

Attachments

  • addtocombonotinlist.txt
    7.1 KB · Views: 190

Bob M

Registered User.
Local time
Today, 00:57
Joined
Sep 11, 2002
Messages
42
Passing Combo Box Value

Thanks Kevin. That did it!! I modified the code for opening the entry form and it worked beautifully.

Thanks to you also Wayne. You people are great!!!
 

Users who are viewing this thread

Top Bottom