add record in subform spreadsheet

E

elburze

My tables are [InvoiceList], [Invoice has Rugs], and [RugList].
Controls RugID and BarCodeNum from [RugList] are both unique numbers, but
only RugID is primary key and auto number.
I have a [Enter Invoice] form with a [Products] subform (spreadsheet).
[Products] shows rugs from [RugList] table; with RugID, BarCodeNum ...etc.
If I manually enter an existing RugID the rest of its record automatically
pops up (good!). Problems is BarCodeNum (not a primary key) is my keyboard
entry rather than RugID. And record pops up only if primary key is manually
entered.

What should I do to add a new rug to my invoice (new record to [Invoice has
Rugs]) by typing its BarCodeNum? These are what come to my mind but none had
any success for me yet:
1) type BarCodeNum on the [Products] subform and use AfterUpdate to set
value of RugID using a query : doesn't work probably because my query
returns a list, what I need is a single RugID, plus I might need to enter
barcodenumber in a separate unbounded box first to keep from creating a new
record
2) Type barcodenumber somewhere in [Enter Invoice] form, find its RugID,
create a new subform just to enter a new record in [Invoice has Rugs], then
refresh the [Products] : new subform will be spreasheet too. Problem is
the same. How to add a record to a subform, or to [Invoice has Rugs] table?
3) Rewrite the database with BarCodeNum as primary key : if nothing else
workes I do this. But then every database I write I should choose primary
keys that go with what I enter in a form. What if I had 2 forms?
4) adding a record using VB commands if possible

Is any of these what I should do? Any suggestions?
 

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

Top