Subdatasheet problem

Mute

Registered User.
Local time
Today, 04:46
Joined
Aug 9, 2004
Messages
34
hello all,

I've come across another little problem in my database.

I have a subdatasheet in my form - this holds the boiler details for clients.

ie. clients form has within it details subdatasheet containg boiler details for that client.

I can add/edit boiler details without any problems but ive noticed that when i delete a client's records the boiler details are still there (although you cant access it through the form).

How do i delete the boiler details along with the client?

Thanx in advance.
 
Tried to enforce referential integrity but i get the error msg:

Data in the table 'BoilerDet' violates referential integrity rules.

BoilerDet being the table used for the subdatasheet
 
you are getting that error message because you already have some boiler details, which you deleted their clients. These are known as orphans. Get rid of those first and then set the referential integrity again.
 
Great thanx,

That worked.

Is there a way to change the confirmation message to one of my own because the one which pops up when deleting a record can be confusing for users?
 
Just noticed sumthing,

my combobox which worked perfectly before now causes problems

when scrolling through the records.

I get a runtime error saying "the value you entered isnt valid for this field"

Whats gone wrong?
 
i do not know how you are deleting records, but by using a command button you can avoid getting the confirmation box.

Code:
Private Sub Command11_Click()
If MsgBox("Are you sure you want to delete the record", vbYesNo, "test") = vbYes Then
DoCmd.SetWarnings warningsoff
DoCmd.RunCommand acCmdDeleteRecord
Else
DoCmd.CancelEvent
MsgBox "Record not deleted", vbOKOnly
End If
End Sub
 
any ideas why i am now getting a runtime error msg?
 
This is what my current delete button has:

Private Sub DelRec_Click()
On Error GoTo Err_DelRec_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_DelRec_Click:
Exit Sub
 
the wizard creates that code, which unfortunately is obsolete. Try the code which i posted in my previous post, it should do the trick.
 
I've tried your code and i get an error.

Compile error: Variable not defined

and the WarningsOff is highlighted in the line

DoCmd.SetWarnings (WarningsOff)

any ideas y that happens?
 
PLZ PLZ PLZ help

I think this is the last thing wrong with my database and i hope someone can help me sort it out.
 
DoCmd.SetWarnings (WarningsOff)
should be

DoCmd.SetWarnings False,
don't forget to turn them back on with
DoCmd.SetWarnings True
at the end of your code
 
Rich suggestion is more accurate, however, on my version of Access (2000) with DoCmd.SetWarnings warningsoff, it deleted the record without confirmation.
 
maxmangion said:
Rich suggestion is more accurate, however, on my version of Access (2000) with DoCmd.SetWarnings warningsoff, it deleted the record without confirmation.
I've noticed this undefined behaviour myself. It doesn't through up any kind of error when using the constant warningsoff, but it will for warningson or any other. wierd.

Relying on the tips from typing is what got me in that trap in the first place :(
 
thank you for the information, therefore it will be better doing it the right way i.e. DoCmd.SetWarnings False
 
Woooo hooooo

Thank u all,

Rich's suggestion worked.
 

Users who are viewing this thread

Back
Top Bottom