Useing Refresh in Module

Crash1hd

Registered CyberGeek
Local time
Today, 04:32
Joined
Jan 11, 2004
Messages
143
I created a function and wanted to use Me.Refresh what would be the equivlant for a module?
 
Crash,

You don't refresh a module ...

Forms![SomeForm].Refresh

Wayne
 
Ok is there a way of making it know what form is already open so if the form name is myform then it would automatically be Forms![myform].Refresh but if it was notmyform then it would be Forms![notmyform].Refresh
 
Crash,

There can be any number of forms open. How would your code know which
one to refresh. Generally, depending on events, the form should know when
it should be requeried/refreshed/recalculated.

If it calls something external that might alter things, then it should perform
a requery/refresh/recalc.

Wayne
 
I see I was just hopeing this would work, I have 6 buttons in 5 forms the 6 buttons are always the same but are form dependant (needing info about the form) for example

Code:
Private Sub Print_Preview_Click() 'Button
On Error GoTo Err_Print_Preview_Click

    Dim stDocName As String
    Dim stLinkCriteria As String
    
    stDocName = "Inbound_Report"
    
    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.OpenReport stDocName, acPreview, , "[Inbound.tblInitials] = """ & Me.tblInitials & """ And [tblInbound_ID] = " & tblInbound_ID

Exit_Print_Preview_Click:
    Exit Sub

Err_Print_Preview_Click:
    MsgBox Err.Description
    Resume Exit_Print_Preview_Click
    
End Sub
Private Sub Email_Inbound_Report_Click()
On Error GoTo Err_Email_Inbound_Report_Click

    If [Forms]![Inbound]![tblEmp_First_Name] <> "" Then
        DoCmd.OpenForm "CC_Email", , , , , , Me.Name
    Else
    Dim Msg, Style, Title, Response
    Msg = Me.tblInitials & " report does not contain a First Name!" & _
        Chr(13) & Chr(13) & "Continue?"
    Style = vbExclamation + vbYesNo
    Title = "Error!"
    Response = MsgBox(Msg, Style, Title)
        If Response = vbYes Then    ' User chose Yes.
            DoCmd.OpenForm "CC_Email", , , , , , Me.Name
        Else    ' User chose No.
            
        End If
    End If

Exit_Email_Inbound_Report_Click:
    Exit Sub

Err_Email_Inbound_Report_Click:
    MsgBox Err.Description
    Resume Exit_Email_Inbound_Report_Click
    
End Sub

where ever the word Inbound is well its the name of the form and could be outbound or other...
 

Users who are viewing this thread

Back
Top Bottom