Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ins/Upd an unbound value into a record

Status
Not open for further replies.

JavaKat

Programmer
Jun 27, 2002
11
US
Many Apologies and Obsequies,

I am (gasp) neither an Access programmer nor the creator of this database, but I was asked for help on this particular problem, and am now incurably curious about the solution.

TABLES:
Code:
Products
- ProductID (PK)
- ProductName (unique)
- ProductDescription

SubProducts
- SubProdID
- ProductName (FK)
- OtherStuff
There can be many sub-products, but each one has to be a sub-type of a certain product. From the Products form, you can select what type of sub-product you need to create. Each sub-product has a separate form by product type (i.e. there's a productA sub-product form, a productB sub-product form, etc.)

Each of these sub-product forms needs to display and pass into the sub-products table the type of product it's describing.

Control-Bound text boxes for "product" in the sub-product form tend to display the last product selected in any form at all... not necessarily the product relevant to the sub-form, even if we set default values, etc.

But an unbound text box, while displaying everything just fine, cannot pass the data into the table when the sub-product is created.

How can we bypass this ... feature?

Please, talk to me like I don't grok Access or VB. ('cuz I don't.)

Pre-emptive Gratitude,

JavaKat
 
Hi JavaKat,

Please explain what you mean by "bypass this". Do you want to add the text entered in the unbound text box to the table or do you want to eliminate some code?

Thanks,

dz
 
Thanks, I'll clarify.

Yes, I do want the value in the products text box to be passed into the table.

JavaKat

 
ok, it's not too difficult, but not all that straightforward either...especially if you haven't used Access or VB. You will need to create a recordset, find the record to add the data to, and add the data. Here's an example:

Dim db as Database
Dim rs as Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("tablename", dbOpenDynaset)

rs.FindFirst <strcriteria> ' strcriteria is a string that identifies the record to search for.

rs.Edit
rs!<fieldname> = <nameoftextbox.Value>
rs.Update

The angle brackets <> are not part of the code. I used them to indicate where you have to enter something. If you provide more details on the name of the unbound field, field in the table that it needs to be stored into, text boxes, etc, I'll try to help further.

dz
 
JavaKat,

I could have sworn that you posted a reply to my message yesterday, but now it's gone. If you still need help with your issue, please post back and I'll try to help further.

Thanks,

dz
 
Nope, I've been busy with Java classpath errors elsewhere.

I've passed this along to the designer of the database, and hopefully it'll help him along.

Thank you so much for your prompt reply!

JavaKat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top