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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

having trouble linking forms

Status
Not open for further replies.

prodcontrol

Technical User
Jan 7, 2004
49
US
I am having trouble linking forms to one main table. I have built all of my forms but, I don't really know how to link them together and they must allow dups.

thanx,
prodcontrol
 
One thing you will need to do is make sure, in desingn view of the form, that the forms Record Source refers to the table.

Your best bet would be to create your tables first and make sure your db is normalized, especially since you want to all duplicates.

An investment in knowledge always pays the best dividends.
by Benjamin Franklin
 
I really want all forms to link to one table! It is possible correct?

prodcontrol
 
One thing you can do is set all of your forms Record Source to the main table. However, if you have a primary key, you will not be allowed to have duplicates.
I have no idea what your table structure is like. Sounds like you should have more than one table.
Again, normalization is really important. If you are not familiar with this, then check help for an explantion.

An investment in knowledge always pays the best dividends.
by Benjamin Franklin
 
This is an e-mail I got from another user!! Does this mean anything to you and if so, how do I do it?

prodcontrol



Hi again!

Finding the correct record (I'm assuming you've altered the record source of the forms to now be the new "main" table?)

That's a little bit tricky with a composite primary key, but doable. Usual way is to create a combobox with a rowsource containing the primary key (here all three fields in being the primary key) and sufficiant other information for the user to identify the correct part.

First - use the combobox wizard to create such. In the first step of the wizard, select the "Find a recorord on..." (third alternative), then select the fields needed to identify the record (ensure the primary key fields are the first three fields)...

Don't know how much coding you know, but in the property of the combobox, you'll find the event tab, and there there's supposed to be an event procedure on the after update of the combo. Enter the code by first placing the cursor in that line and then pressing the button with three dot's to the right of that line.

There the code, after some tweaking, should look perhaps something like this:

Private Sub ComboN_AfterUpdate()
dim rs as object
set rs=me.recordsetclone
rs.findfirst "[A/C] =" & Me!ComboN & _
" [Card] =" & Me!ComboN.Column(1) & _
" [Part Number] = " & Me!ComboN.Column(2)
if not rs.eof then me.bookmark=rs.bookmark
set rs=nothing

Coupla notes here:
* the primary key field must be in the recordsource of the form (don't have to be present as controls on the form)
* this example assumes all the fields are numeric, if not, text qualifiers are needed (')
* the rowsource of the combo - a/c must be the first field, then card, then part number, cause of the assigning
* i might have misspelt the field names, they probably need correcting

Example if datatype is text:
" [Part Number] = '" & Me!ComboN.Column(2) & "'"

 
This email does mean something, however, it refers to

Finding the correct record...

Your original question had to do with
....trouble linking forms to one main table... and ....they must allow dups....


Now I am confused.

An investment in knowledge always pays the best dividends.
by Benjamin Franklin
 
Exactly!

I guess that was my problem with the code, I could not get it to do what I needed it to do with the linking problem and allowing dups. Can you help?

prodcontrol[smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top