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

how & where does new id of the record??

Status
Not open for further replies.

qajussi

Programmer
Mar 22, 2004
236
0
0
US
Hi!

I have a mainform A with a button to call another form B.
Say mainform A is People form and form B is book form
I want to enter name of books a person read.

Mainform A
ID Name
12 John

from this form click a button to open the form B to enter name of books he read.

Form B must show previosly added book name if it is a first time addding.

My question.
Where does the ID of book form get created???

I have a client's code and I don't see the code where the ID of second form gets created.
What I see is when
a button is clicked from the mainform A
(DoCmd.OpenForm formB,,stCriteria,,ParentID)
and
some event procedures.

But I don't see anywhere from the code,
where actual data got updated to the table or new id gets created.

Can you help??



 
Seems that formB is bound to a junction table (many-to-many relationship between People and Book)
What is the Primary Key of this table ?
Either an AutoNumber and then automatically created by Access
Or the combination of PeopleID (passed as OpenArgs I guess) and BookID (choosen in a Combo I suppose).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV.

Yes parentID(People) is passed in as openArgs.
I suspect it might be autonumber and automatically created by access.

Do you think that is why I don't see any update code for added information to the form B.
 
I suspect it might be autonumber
You don't know the schema of your database ?
Open the underlaying table in the table design window and display the Index window.
I don't see any update code for added information
This is not necessary for Bound forms.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV.

I am really stucked for a week now.
I don't fully understand how it works.
He is my situation.

Everything works fine in Access but we upsized the backend database to the SQL server and using the access forms.

Here are three tables.

tblPeople
PeopleID
Name

tblPeopleBook
PeopleID
BookID

tblBook
BookID
BookName

from the People form I click a button to bring the book form to enter the data.
I get the book form and let me enter the book name but as soon as I try to close it to save or add another book name,
I get an error saying the it can't find the matching BookID in the peopleBook due to there is no BookID.

it seems like it is not creating the bookID when I enter a book name.

I guess acces create the BookID because I don't see anywhere in the code where it gets added(record information) or create a bookID.

Where should I look at??
I hope I explained enough to get some help.
Thanks. again.
 
Sorry for not enough info.

Book Form has this as record source:
Select PeopleBook.PeopleID, Book.* from PeopleBook inner join Book on peopleBook.BookID = Book.BookID where
PeopleBook.PeopleID = '123'

What if PeopleID ='123' has no book record yet.
So book from should come out empty right??

I don't see any code for creating new records.
Where does a new record and bookID get created??
Thanks.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top