Doing my head in??? (1 Viewer)

mark curtis

Registered User.
Local time
Today, 04:15
Joined
Oct 9, 2000
Messages
457
Dear all,

I have posted this question before and I thank the guys who responded but I still can not get it to work so here we go again:

I have a tabbed form built on a table and within one of the tabs I have a sub form(fsubProduct) in datasheet view that holds product records and is filtered by ProjectID(Master/Child) I then have another subform (fsubAcceptance) also in datasheet that is linked by the ProductID in (fsubProduct).

In short mainform - fsubProduct (Linked by ProjectID)and fsubProduct - fsubAcceptance (Linked by ProductID).

So whats the problem?????

Well when a user moves from record to record in fsubProduct I make the associated records in fsubAcceptance appear by using the OnCurrent event in fsubProduct. My problem is that if a user goes straight to the fsubAcceptance to enter data and there is no parent entry in fsubProduct, I get the error message saying Index or Primary Key can not contain null.

I have tried all sorts of if isnull etc but it still will not work.

IS There Anyway in which I could modify the default error message that appears and clear the entry thus sending the focus back to fsubProduct??

Sorry about the essay but I'm STUCK!!!!!

Thanks
Mark
 

jabrum

Registered User.
Local time
Today, 04:15
Joined
Jun 1, 2001
Messages
10
Let me prefix this reply by saying that I don't know @$% about VB and I'm self taught for the most part when it comes to access.

That said, I had a similar situation. A parent/child relationship problem where they were connected by a common PrimaryID. The two forms were tabbed. The data for each form was stored in separate tables. My problem was that if somone tried to enter info in the child form, a record simply didn't exist, even though it was linked by the PrimaryID.

Here's what I did to make it work. I have no idea if this is a suggested fix, or if there is anything else that might be easier. I created an query that compared the two tables and showed the records that were in the ParentTable but NOT in the childTable. I then turned that into an append query, to append/create those absent records into the childTable. I then created a macro to run that query and stuck it on the AfterUpdate event of something very common on the Parentform.

For example, when creating a new record in the ParentForm, on enterine the Last_Name (3rd field in tab order), that macro runs and automatically creates a record in the child form with the linked PrimaryID! It works beautifully!

I don't know if this can help. Best Luck!
Jon

[This message has been edited by jabrum (edited 06-05-2001).]

[This message has been edited by jabrum (edited 06-05-2001).]
 

Users who are viewing this thread

Top Bottom