"...A Related record is required...."

O

Opal

I am trying to figure out how to do something and getting no where
fast.
I have a database where users from 2 separate shifts enter data from
their shift when they have an issue with a piece of equipment. If
both
shifts have the same concern then the issue is raised up to another
group to create a countermeasure for the problem.

I have created a query that will show common issues between the
two shifts. I show the query results in a form. I want to send the
query results to a table via the form. When I attempt to submit
the record to the new table I get the following error message:

"You cannot add or change a record because a related record
is required in table 'BShifttbl'."

What does this mean and how do I get past it? Please help!
 
O

Opal

I am trying to figure out how to do something and getting no where
fast.
I have a database where users from 2 separate shifts enter data from
their shift when they have an issue with a piece of equipment. If
both
shifts have the same concern then the issue is raised up to another
group to create a countermeasure for the problem.

I have created a query that will show common issues between the
two shifts. I show the query results in a form. I want to send the
query results to a table via the form. When I attempt to submit
the record to the new table I get the following error message:

"You cannot add or change a record because a related record
is required in table 'BShifttbl'."

What does this mean and how do I get past it? Please help!

I have tried to add the following to my VBA code on my form:

If Me.Dirty Then Me.Dirty = False
Exit Sub
End If

and I am getting a Compile Error:
End If without block If.

Can anyone help?
 
R

Rick Brandt

Opal said:
I have tried to add the following to my VBA code on my form:

If Me.Dirty Then Me.Dirty = False
Exit Sub
End If

and I am getting a Compile Error:
End If without block If.

Can anyone help?

An If-Then statement on one line needs no End If...

If Me.Dirty Then Me.Dirty = False

An If-Then block that has an End If should have nothing on the line after
"Then"...

If Me.Dirty Then
Me.Dirty = False
Exit Sub
End If
 
O

Opal

An If-Then statement on one line needs no End If...

If Me.Dirty Then Me.Dirty = False

An If-Then block that has an End If should have nothing on the line after
"Then"...

If Me.Dirty Then
Me.Dirty = False
Exit Sub
End If

Thank you, Rick. But now I am still getting the same error:

"You cannot add or change a record because a related record
is required in table 'BShifttbl'."
 
R

Rick Brandt

Opal said:
Thank you, Rick. But now I am still getting the same error:

"You cannot add or change a record because a related record
is required in table 'BShifttbl'."

I can only answer that by example. Take the case of two tables, Orders and
OrderLineItems related one to many (one order can have one or more items).

If the relationship between the tables is set up with enforced referential
integrity I would not be allowed to add a record to OrderLineItems unless its
OrderNumber field value also existed in a record of the Orders table. If I
tried I would get the same error you are.

Your process must be doing something similar.
 
O

Opal

I can only answer that by example. Take the case of two tables, Orders and
OrderLineItems related one to many (one order can have one or more items).

If the relationship between the tables is set up with enforced referential
integrity I would not be allowed to add a record to OrderLineItems unless its
OrderNumber field value also existed in a record of the Orders table. If I
tried I would get the same error you are.

Your process must be doing something similar.

Thank you, Rick, I see that now....I do have "one to many"
relationships
established because I want to be able to run a delete query to remove
duplicate data between tables.....

However, when I run the delete query it removes the data from both
tables??

This started out as a simple database has now grown more and more
complicated.
 
O

Opal

Thank you, Rick, I see that now....I do have "one to many"
relationships
established because I want to be able to run a delete query to remove
duplicate data between tables.....

However, when I run the delete query it removes the data from both
tables??

This started out as a simple database has now grown more and more
complicated.- Hide quoted text -

- Show quoted text -

Okay, figured out the delete query...removed the cascade deletes.
 

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