Relationship Set Up (1 Viewer)

Emma35

Registered User.
Local time
Today, 05:40
Joined
Sep 18, 2012
Messages
467
Hi All,
I have a new database in which the table set up doesn't seem to be working. I'm using the form frm_AddNewRA to enter data but i'm getting an error saying there's missing data in a related table. Could one or two of you wise people have a look and tell me what i need to change ?

Thanks a lot,
Em
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 13:40
Joined
Jan 14, 2017
Messages
18,207
I've just had a quick look
You have a one-many relationship with referential integrity between tblTasks and tblHazards and are attempting to add a new record in many side i.e. tblHazards.
However as the error message states there is no corresponding record in tblTasks.
You must populate that first.

I haven't studied your code but recommend you do not use SendKeys as it can be unreliable.

Also not sure what this does
Code:
Private Sub cmdForward_Click()
Me.ctlAttachment.Forward
End Sub
 

Emma35

Registered User.
Local time
Today, 05:40
Joined
Sep 18, 2012
Messages
467
Hi thanks for the reply. I'll remove the SendKeys code. I thought i had populated the record in tbl_Tasks when i type a task into the form...this is what's confusing me ?
The other piece of code is for cycling through the attachments using a command button
 

isladogs

MVP / VIP
Local time
Today, 13:40
Joined
Jan 14, 2017
Messages
18,207
I'd also strongly advise against using the attachment datatype as it causes database bloat and can lead to problems as a result.
 

Emma35

Registered User.
Local time
Today, 05:40
Joined
Sep 18, 2012
Messages
467
I'm not a fan of attachments either but i'm told this database will only have about 100 records at the most and each one will have a 50kb pdf file as an attachment so i think we'll be ok.

Still not sure why i'm getting the missing data error ?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 07:40
Joined
Feb 28, 2001
Messages
27,122
"Missing data" in tables having relational integrity usually means that you have a parent & child relationship between two tables and you are attempting to created an orphan child.
 

Emma35

Registered User.
Local time
Today, 05:40
Joined
Sep 18, 2012
Messages
467
Ah that's it...you put me on the right track. The parent child relationship between the two tables wasn't set up properly. I altered it and everything's fine. Thanks for your help guys.

Em x
 

Users who are viewing this thread

Top Bottom