[AccessD] x posted Get name for message box

Arthur Fuller artful at rogers.com
Sun Nov 21 10:45:00 CST 2004


I'd write a wrapper function rather than calling MsgBox directly. 
Something along the lines of ....

<code>
Function JH_MsgBox( strSubstitute, strTitle ) As Integer
Dim intResult as Integer
intResult = MsgBox( "You have chosen to delete employee " & 
strSubstitute, vbYesNo, strTitle )
JH_MsgBox = intResult
</Code>

How you get the list of related rows in other tables depends a LOT on 
how thorough you are in documenting your tables' relationships. Assuming 
that you are thorough, you can get the list of related tables with a 
query against MSysRelationships. Make this table visible (show system 
objects) and browse it, and the contents are self-explanatory. The 
general principle is that the One table precedes the Many table in the 
naming scheme. The PKs and FKs are named so you could easily construct a 
query to list the related tables.

Maybe this is going to result in a graceful routine, but I guess that in 
my advanced years I've grown lazy. I just declare Cascade-Delete OFF and 
let Access handle it. If and when the client complains, I just say, 
"Such a potentially disastrous action should NOT be easy." If you want 
to delete a salesperson and then all her sales orders and then all the 
sales details, then I'm going to make it difficult for you, so you will 
appreciate the consequences of your actions.

Arthur
Joe Hecht wrote:

>Thanks Steve,
>
>Gotta love these lists
>
>New problem: How do I get related records in other tables?
>
>JOE HECHT
>LOS ANGELES CA 
> jmhla at earthlink.net
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht
>Sent: Saturday, November 20, 2004 8:28 PM
>To: 'Access Developers discussion and problem solving'; 'ACCESS-L'
>Subject: [AccessD] x posted Get name for message box
>
>I have the following code for the on click event of a form. I want to
>replace " this employee " with the current employee name on the form.
>
> 
>
>How do I do that?
>
> 
>
>Private Sub cmdDelEmp_Click()
>
>    ' Comments  Confirm Employeee Deletion:
>
>    ' Parameters:  -
>
>    ' Modified  :
>
>    Dim lngRetval As Long
>
> 
>
>    lngRetval = MsgBox( _
>
>        "You have chosen to delete this employee!" & vbCrLf & "" & vbCrLf &
>"Do you wish to continue?", _
>
>        vbYesNoCancel + vbQuestion + vbSystemModal + vbDefaultButton1, _
>
>        "Confirm Emplyee Deletion")
>
> 
>
>    Select Case lngRetval
>
>        Case vbYes
>
>             DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
>
>             DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
>
>        
>
>        Case vbNo
>
>        Case vbCancel
>
>    End Select
>
>    '
>
>    ' -------------------------------------
>
>    
>
>  
>
>    
>
>Exit_cmdDelEmp_Click:
>
>    Exit Sub
>
>    
>
>Err_cmdDelEmp_Click:
>
>    MsgBox Err.Description
>
>    Resume Exit_cmdDelEmp_Click
>
>    
>
>End Sub
>
>JOE HECHT
>
>LOS ANGELES CA 
>
>jmhla at earthlink.net
>
> 
>
>  
>


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 265.4.1 - Release Date: 11/19/2004




More information about the AccessD mailing list