Ανανέωση ιστοσελίδας

Access - Ερωτήσεις / Απαντήσεις Access + VBA... Εδώ δεν υπάρχουν όρια!

Απάντηση στο θέμα

 

Εργαλεία Θεμάτων Τρόποι εμφάνισης
  #1  
Παλιά 23-03-20, 11:10
Όνομα: ΙΩΑΝΝΗΣ
Έκδοση λογισμικού Office: Ms-Office 2007
Γλώσσα λογισμικού Office: Ελληνική
 
Εγγραφή: 27-01-2020
Μηνύματα: 83
Προεπιλογή Compile error-ambiguous name detected

Καλημερα.Εχω κατεβασει την εφαρμογη ημερολογιου και την εβαλα στην δικια μου βαση.Οταν κανω compile την βαση μου βγαζει το συγκεκριμενο error compile error ambiguous name detected

http://www.ms-office.gr/forum/access...se-access.html

O κωδικας που βρισκει το σφαλμα ειναι και ατο σημειο με bold ειναι το σφαλμα

Κώδικας:
Option Compare Database
Dim fAlreadyResetAllHotSpots As Boolean 'used so we don't call resethotspots too many times
Dim oCal As Form 'used to display the calendar control
Dim oMood As Form 'used to display the mood form
Dim oSearch As Form 'used to display the search wizard
Const iHotSpots = 18 'number of hotspots on the form
Dim iGUIBUG As Integer 'used so that we only reload the image of the form a few times
Dim fFirstLocFlag As Boolean 'used to skip writing status text out the first time the form loads

'********************
'temp variables
Dim iTemp As Integer
Dim i As Integer
'********************

'******************************************************************************************
'called by the calendar control to let us know the user has selected a date
'******************************************************************************************
Public Sub CalendarCallBack(sDate As Variant)
    On Error GoTo PROC_ERR

    oCal.Visible = False
    Me.PictureAlignment = 0
    Me.FilterOn = True
    Me.Filter = "[EntryDate] = #" & Format(sDate, "mm/dd/yyyy") & "#"
    TurnOnSearchFilter

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'checks to see if we need to reset the hotspots (hide them all)
'******************************************************************************************
Public Sub CheckResetHotSpots()
    On Error GoTo PROC_ERR

    If fAlreadyResetAllHotSpots = False Then
        ResetHotSpots
        fAlreadyResetAllHotSpots = True
    End If

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'will ensure that the calendar popup and mood popups are hidden
'******************************************************************************************
Public Function HideAllPopups() As Integer
    On Error GoTo PROC_ERR

    HideCalPopup
    HideMoodPopup

PROC_EXIT:
    Exit Function

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Function

'******************************************************************************************
'this will hide the calendar popup
'******************************************************************************************
Public Sub HideCalPopup()
    On Error GoTo PROC_ERR

    If oCal.Visible = True Then oCal.Visible = False

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this will hide the mood popup form
'******************************************************************************************
Public Sub HideMoodPopup()
    On Error GoTo PROC_ERR

    If oMood.Visible = True Then oMood.Visible = False

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'when the user clicks on a hotspot try to give some visual feedback by playing with the
'special effects
'******************************************************************************************
Public Sub HotSpotClick(sControlName As String)
    On Error GoTo PROC_ERR

    Me.Controls(sControlName).SpecialEffect = 2
    Sleep 0.1
    Me.Controls(sControlName).SpecialEffect = 3
    DoEvents

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
' called when changing the UI language
'******************************************************************************************
Public Sub LocMe()
    'Call the global loc first
    On Error GoTo PROC_ERR

    LocForm Me

    'now handle special situations here
    '************************************

    'update the status text
    If fFirstLocFlag Then
        fFirstLocFlag = False
    Else
        WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 85")
    End If

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'called by the mood control to let us know the user has selected a mood
'******************************************************************************************
Public Sub MoodCallBack(iMood As Integer)
    On Error GoTo PROC_ERR

    oMood.Visible = False
    Me.PictureAlignment = 0
    Me.EntryMood = iMood
    UpdateMoodIcon
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 75")

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'wraps the "newrecord" property for expressions
'probably only used in the "display date & time" textbox of the entry
'******************************************************************************************
Public Function OnNewRecord() As Boolean
    On Error GoTo PROC_ERR

    OnNewRecord = Me.NewRecord

PROC_EXIT:
    Exit Function

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Function

'******************************************************************************************
'resets all of the hotspots on the form
'******************************************************************************************
Public Sub ResetHotSpots()
    'resets all hotspots on the form
    On Error GoTo PROC_ERR

    For i = 1 To iHotSpots
        If Me.Controls("hot" & i).SpecialEffect <> 0 Then Me.Controls("hot" & i).SpecialEffect = 0
        If Me.Controls("hot" & i).Caption <> "" Then Me.Controls("hot" & i).Caption = ""
    Next i

    'set flag to true so we know we already reset them all
    fAlreadyResetAllHotSpots = True

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'called by the search wizard with what we are supposed to filter to
'******************************************************************************************
Public Sub SearchCallBack(sSQL As String)
    'hide the wizard
    On Error GoTo PROC_ERR

    oSearch.Visible = False
    Me.PictureAlignment = 0

    'set the filter
    Me.Filter = sSQL
    If Me.FilterOn <> True Then Me.FilterOn = True

    'turn on the filter ui for the form
    TurnOnSearchFilter

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this will check to see if the hotspot is turned on for a control, if it is not then
'it will turn it on.  only one control can have a hotspot on.
'******************************************************************************************
Public Sub TurnOnHotSpot(sControlName As String)
    'If this button is alread highlighed do nothing
    On Error GoTo PROC_ERR

    If Me.Controls(sControlName).SpecialEffect > 0 Or Me.Controls(sControlName).Caption <> "" Then
        'nothing, already selected
    Else
        ResetHotSpots
        fAlreadyResetAllHotSpots = False
        Select Case sControlName
            Case Is = "hot3"
                HideMoodPopup
            Case Is = "hot5"
                HideCalPopup
            Case Else
                HideAllPopups
        End Select

        If Left$(Me.Controls(sControlName).Tag, 1) <> "*" Then
            Me.Controls(sControlName).SpecialEffect = 3
        Else
            Me.Controls(sControlName).Caption = Left$(Me.Controls(sControlName).Tag, 1)
        End If
    End If

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'will updat the mood icon based on the forms recordset value
'pass in the new record option for the form current event so we know if the user navigated
'to the new record opposed to if they are changing mood in a new record.
'******************************************************************************************
Public Sub UpdateMoodIcon()
    On Error GoTo errUpdateMoodIcon

    iTemp = IIf(IsNull(Me.EntryMood), 1, Me.EntryMood) 'if it's null then we are on a new record
    If Me.Controls("img" & iTemp).Visible = False Then
        'hide all other images
        For i = 1 To 11
            If Me.Controls("img" & i).Visible = True Then Me.Controls("img" & i).Visible = False
        Next i
        Me.Controls("img" & iTemp).Visible = True
    End If
    Exit Sub

errUpdateMoodIcon:
    If Err.Number = 3167 Then
        'nothing, know error
    Else
        MsgBox Err.Description & " " & Err.Number, vbOKOnly, "Diary Application"
    End If
End Sub

'******************************************************************************************
'used to simulate the writing of the text in the status text
'******************************************************************************************
Public Sub WriteOutStatus(sText As String)
    On Error GoTo PROC_ERR

    Me.TimerInterval = 0
    lblStatus.Caption = ""
    For i = 1 To Len(sText)
        lblStatus.Caption = Left(sText, i) & "_"
        Sleep 0.01
    Next i
    Me.TimerInterval = 1000

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'when the user moves the mouse over the detail section we should reset the hotspots
'******************************************************************************************
Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    CheckResetHotSpots

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'when the main text box gets focus, be sure everything in the screen is reset
'******************************************************************************************
Private Sub EntryText_GotFocus()
    On Error GoTo PROC_ERR

    HideAllPopups
    CheckResetHotSpots

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the entry text textbox, reset the hot spots
'******************************************************************************************
Private Sub EntryText_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    CheckResetHotSpots

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
    Response = acDataErrContinue
End Sub

'******************************************************************************************
'if the record changes then be sure we've loaded the correct mood icon
'******************************************************************************************
Private Sub Form_Current()
    On Error GoTo PROC_ERR

    UpdateMoodIcon
    If Me.OnNewRecord Then
        txtDisplayDateTime.Caption = DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 51")
    Else
        txtDisplayDateTime.Caption = FormatDateTime([EntryDate], 1) & " at " & [EntryTime]
    End If

    txtDisplayDateTime.Caption = IIf(OnNewRecord() = True, DLookup("[text0]", "[tblStrings]", "ID = 51"), FormatDateTime([EntryDate], 1) & " at " & [EntryTime])

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this is the initlization of the diary entry form
'1. set all the hotspot captions to empty string
'2. load our own calendar control and set the callback
'3. load the mood form and set the callback
'4. load the search form and set the callback
'5. see if we need to be localized
'******************************************************************************************
Private Sub Form_Load()
    
    '1. set all the hotspot captions to empty string
    On Error GoTo PROC_ERR

    For i = 1 To iHotSpots
        Me.Controls("hot" & i).Caption = ""
    Next i

    '2. load our own calendar control and set the callback
    Set oCal = New Form_frmCalendar
    oCal.SetupCallBack Me

    '3. load the mood form and set the callback
    Set oMood = New Form_frmMoods
    oMood.SetupCallBack Me

    '4. load the search form and set the callback
    Set oSearch = New Form_frmSearchWizardMain
    oSearch.SetupCallBack Me

    '5. see if we need to be localized
    fFirstLocFlag = True
    LocMe

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'when the user moves the mouse over the form we should reset the hotspots
'******************************************************************************************
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    CheckResetHotSpots

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'the form timer controls the blinking of the status bar cursor
'******************************************************************************************
Private Sub Form_Timer()
    On Error GoTo PROC_ERR

    If Right(lblStatus.Caption, 1) = "_" Then
        lblStatus.Caption = Left(lblStatus.Caption, Len(lblStatus.Caption) - 1)
    Else
        lblStatus.Caption = lblStatus.Caption & "_"
    End If

    If iGUIBUG < 10 Then
        iGUIBUG = iGUIBUG + 1
        Me.PictureAlignment = 0
    End If

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'when we unload the form, be sure to destroy all related obects
'******************************************************************************************
Private Sub Form_Unload(Cancel As Integer)
    On Error GoTo PROC_ERR

    HideAllPopups
    Set oCal = Nothing
    Set oMood = Nothing
    Set oSearch = Nothing

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the previous button, take them back to their previous entry
'******************************************************************************************
Private Sub hot1_Click()
    On Error GoTo IgnoreError
    HotSpotClick "hot1"
    DoCmd.GoToRecord , , acPrevious
    Me.PictureAlignment = 0
    WriteOutStatus "<-- "
IgnoreError:
    If Err.Number = 2105 Then
        'this means we cannot goto the specified record
        WriteOutStatus "Currently at the first diary entry."
    End If
End Sub

'******************************************************************************************
'mouse moved over the previous button, set the hotspot visible
'******************************************************************************************
Private Sub hot1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot1"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the paste button, paste and update status text
'*****************************************************************************************
Private Sub hot10_Click()
    On Error GoTo hot10_Click_err
    DoCmd.RunCommand acCmdPaste
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 81")
    Exit Sub

hot10_Click_err:
    MsgBox Err.Description, vbOKOnly, DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 38")
End Sub

'******************************************************************************************
'mouse moved over the paste button, set the hotspot visible
'******************************************************************************************
Private Sub hot10_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot10"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the undo button, undo and update status text
'*****************************************************************************************
Private Sub hot11_Click()
    On Error GoTo hot11_Click_err
    DoCmd.RunCommand acCmdUndo
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 82")
    Exit Sub

hot11_Click_err:
    MsgBox Err.Description, vbOKOnly, DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 38")
End Sub

'******************************************************************************************
'mouse moved over the undo button, set the hotspot visible
'******************************************************************************************
Private Sub hot11_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot11"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the redo button, redo and update status text
'*****************************************************************************************
Private Sub hot12_Click()
    On Error GoTo hot12_Click_err
    DoCmd.RunCommand acCmdRedo
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 83")
    Exit Sub

hot12_Click_err:
    MsgBox Err.Description, vbOKOnly, DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 38")
End Sub

'******************************************************************************************
'mouse moved over the redo button, set the hotspot visible
'******************************************************************************************
Private Sub hot12_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot12"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the spellcheck button, spellcheck and update status text
'*****************************************************************************************
Private Sub hot13_Click()
    On Error GoTo PROC_ERR

    EntryText.SetFocus
    DoCmd.RunCommand acCmdSpelling
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 84")

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the spellcheck button, set the hotspot visible
'******************************************************************************************
Private Sub hot13_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot13"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the change language button, change language and update status text
'*****************************************************************************************
Private Sub hot14_Click()
    On Error GoTo PROC_ERR

    DoCmd.OpenForm "frmLanguage"
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 85")

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the change language button, set the hotspot visible
'******************************************************************************************
Private Sub hot14_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot14"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the print button, start print wizard and update status text
'*****************************************************************************************
Private Sub hot15_Click()
    'update the status
    On Error GoTo PROC_ERR

    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 86")

    'save the current record
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

    'open the report filtered to the current entry
    DoCmd.OpenReport "rptPrintEntry" & iLang, acViewPreview, , "[Entrydate] = #" &  _ 
                                                             Format(Me.EntryDate, "mm\/dd\/yyyy") & "# and [entrytime] = #" & Format(Me.EntryTime, "h:m:s") & "#"
    DoCmd.Maximize

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the print button, set the hotspot visible
'******************************************************************************************
Private Sub hot15_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot15"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the email button, export current text to email and update status text
'*****************************************************************************************
Private Sub hot16_Click()
    On Error GoTo PROC_ERR

    Dim oOutlook As Outlook.Application 'application we are going to use to send mail
    Dim oEmail As Outlook.MailItem 'email message we're going to create

    'let the user know we are starting the export to email
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 87")

    'startup outlook, if it is already started it will grab the current session
    Set oOutlook = New Outlook.Application
    Set oEmail = oOutlook.CreateItem(olMailItem)

    'set the subject of the email
    oEmail.Subject = DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 91") & " " & txtDisplayDateTime.Caption

    'set the body of the email
    EntryText.SetFocus
    If iLang = 0 Then
        'english
        oEmail.Body = "Mood: " & DLookup("[moodtext]", "[tblmood]", "[moodid] = " & Me.EntryMood) & vbCrLf & vbCrLf & EntryText.Text
    Else
        'spanish
        oEmail.Body = "Humor: " & DLookup("[moodtext2]", "[tblmood]", "[moodid] = " & Me.EntryMood) & vbCrLf & vbCrLf & EntryText.Text
    End If

    'show the email to the user
    oEmail.Display

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the email button, set the hotspot visible
'******************************************************************************************
Private Sub hot16_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot16"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the new entry button, move to a new entry
'******************************************************************************************
Private Sub hot17_Click()
    On Error GoTo PROC_ERR

    HotSpotClick "hot17"
    DoCmd.GoToRecord , , acNewRec
    WriteOutStatus "-->* "

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the new entry button, set the hotspot visible
'******************************************************************************************
Private Sub hot17_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot17"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the turn filter off button, turn off the filter
'******************************************************************************************
Private Sub hot18_Click()
    On Error GoTo PROC_ERR

    HotSpotClick "hot18"
    TurnOffSearchFilter
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 94")

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the turn filter off button, set the hotspot visible
'******************************************************************************************
Private Sub hot18_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot18"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the next button, take them to the next record
'******************************************************************************************
Private Sub hot2_Click()
    On Error GoTo IgnoreError
    HotSpotClick "hot2"
    DoCmd.GoToRecord , , acNext
    Me.PictureAlignment = 0
    WriteOutStatus "--> "
IgnoreError:
    If Err.Number = 2105 Then
        'this means we cannot goto the specified record
        WriteOutStatus "Currently at the last diary entry."
    End If
End Sub

'******************************************************************************************
'mouse moved over the next button, set the hotspot visible
'******************************************************************************************
Private Sub hot2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot2"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the calendar button, open and display the calendar form
'******************************************************************************************
Private Sub hot3_Click()
    On Error GoTo PROC_ERR

    HotSpotClick "hot3"
    oCal.Move Me.WindowLeft + 1000, Me.WindowTop + 1200
    oCal.LoadDate date
    oCal.Visible = Not (oCal.Visible)
    Me.PictureAlignment = 0

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the calendar button, set the hotspot visible
'******************************************************************************************
Private Sub hot3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot3"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the search button, open and display the search form
'******************************************************************************************
Private Sub hot4_Click()
    On Error GoTo PROC_ERR

    HotSpotClick "hot4"
    oSearch.Visible = False
    oSearch.ResetWizard
    oSearch.Move Me.WindowLeft + 2000, Me.WindowTop + 1300
    oSearch.Visible = True
    Me.PictureAlignment = 0
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 96")

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the search button, set the hotspot visible
'******************************************************************************************
Private Sub hot4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot4"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the mood dropdown button, display the mood selecting form
'******************************************************************************************
Private Sub hot5_Click()
    On Error GoTo PROC_ERR

    oMood.Move Me.WindowLeft + 8650, Me.WindowTop + 2050
    oMood.Visible = Not (oMood.Visible)
    oMood.TimerInterval = 1000
    Me.PictureAlignment = 0

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the mood dropdown, set the hotspot visible
'******************************************************************************************
Private Sub hot5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot5"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the save button, save and update status text
'******************************************************************************************
Private Sub hot6_Click()
    On Error GoTo PROC_ERR

    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 76")
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the save button, set the hotspot visible
'******************************************************************************************
Private Sub hot6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot6"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the delete button, delete and update status text
'*****************************************************************************************
Private Sub hot7_Click()
    On Error GoTo hot7_Click_err
    If MsgBox(DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 92"), vbYesNo, DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 38")) = vbYes Then
        DoCmd.RunCommand acCmdDeleteRecord
        WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 77")
    Else
        WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 78")
    End If
    Exit Sub

hot7_Click_err:
    MsgBox Err.Description, vbOKOnly, DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 38")
End Sub

'******************************************************************************************
'mouse moved over the delete button, set the hotspot visible
'******************************************************************************************
Private Sub hot7_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot7"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the cut button, cut and update status text
'*****************************************************************************************
Private Sub hot8_Click()
    On Error GoTo hot8_Click_err
    DoCmd.RunCommand acCmdCut
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 79")
    Exit Sub
hot8_Click_err:
    MsgBox Err.Description, vbOKOnly, DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 38")
End Sub

'******************************************************************************************
'mouse moved over the delete button, set the hotspot visible
'******************************************************************************************
Private Sub hot8_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot8"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'this means the user clicked the copy button, copy and update status text
'*****************************************************************************************
Private Sub hot9_Click()
    On Error GoTo hot9_Click_err
    DoCmd.RunCommand acCmdCopy
    WriteOutStatus DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 80")
    Exit Sub

hot9_Click_err:
    MsgBox Err.Description, vbOKOnly, DLookup("[text" & iLang & "]", "[tblStrings]", "ID = 38")
End Sub

'******************************************************************************************
'mouse moved over the copy button, set the hotspot visible
'******************************************************************************************
Private Sub hot9_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    TurnOnHotSpot "hot9"

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'mouse moved over the Filter description, turn off all hotspots
'******************************************************************************************
Private Sub lblFilterOn_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error GoTo PROC_ERR

    CheckResetHotSpots

PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Sub

'******************************************************************************************
'turns off the search filter and hides the ui for it
'******************************************************************************************
Private Function TurnOffSearchFilter()
    'see if there is a filter currently applied
    On Error GoTo PROC_ERR

    If lblFilterOn.Visible = True Then
        If Me.FilterOn <> False Then Me.FilterOn = False
        lblFilterOn.Visible = False
        hot18.Visible = False
        btnFilterOn.Visible = False
    End If

PROC_EXIT:
    Exit Function

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Function

'******************************************************************************************
'used to turn on the ui for the filter
'******************************************************************************************
Private Function TurnOnSearchFilter()
    On Error GoTo PROC_ERR

    lblFilterOn.Visible = True
    hot18.Visible = True
    btnFilterOn.Visible = True

PROC_EXIT:
    Exit Function

PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT

End Function

Τελευταία επεξεργασία από το χρήστη Tasos : 23-03-20 στις 14:51.
Απάντηση με παράθεση
  #2  
Παλιά 23-03-20, 14:47
Το avatar του χρήστη Tasos
Διαχειριστής
Όνομα: Τάσος Φιλοξενιδης
Έκδοση λογισμικού Office: Ms-Office 365
Γλώσσα λογισμικού Office: Ελληνική, Αγγλική, Γερμανική
 
Εγγραφή: 21-10-2009
Μηνύματα: 2.011
Προεπιλογή

Καλησπέρα σε όλους!

Γιάννη δεν μπορούμε να σε βοηθήσουμε όταν επισυνάπτεις τα αρχεία/παραδείγματα που λειτουργούν.

Θα χρειαστεί να επισυνάπτεις τα προβληματικά αρχεία με παραδειγματικά δεδομένα για να δούμε το πρόβλημα και να σε βοηθήσουμε.

ambiguous name = διφορούμενο όνομα

Κάπου υπάρχει κάποια έκφραση ή όνομα περισσότερες από μία φορές στη κλάση της φόρμας όπου επικόλλησες τον κώδικα.

Αρχικά έλεγξε αν η έκφραση: Option Compare Database υπάρχει πάνω από μια φορά στον κώδικα της φόρμας σου.

Στον κώδικα υπάρχουν ονόματα στοιχείων ελέγχου που ίσως να μην αντιστοιχούν στα ονόματα των στοιχείων ελέγχου της φόρμας σου. Και εκεί θα πρέπει να επέμβεις μετονομάζοντας τα στοιχεία στον κώδικα ή στη φόρμα σου για να μπορέσεις να κάνεις μεταγλώττιση (Compile) στον κώδικα.

Καλή συνέχεια!

Τάσος
__________________
Ms-Office Development Team
Ανάπτυξη επαγγελματικών εφαρμογών
Απάντηση με παράθεση
  #3  
Παλιά 23-03-20, 22:23
Όνομα: ΙΩΑΝΝΗΣ
Έκδοση λογισμικού Office: Ms-Office 2007
Γλώσσα λογισμικού Office: Ελληνική
 
Εγγραφή: 27-01-2020
Μηνύματα: 83
Προεπιλογή

Τασο μαλλον το ελυσα. https://easyupload.io/kjrctf
-------------------------------
1)Στην δικια μου βαση οπως ειπα εχω βαλη την εφαρμογη απ οτο forum "diary" η οποια εχει μια φορμα

"frm_Entry_Main" οπου εχει μεσα την Public Sub Sleep(sngTime As Single) και το module

"BasShared"
|
|
\/
Public Sub HotSpotClick(sControlName As String)
On Error GoTo PROC_ERR

Me.Controls(sControlName).SpecialEffect = 2
Sleep 1
Me.Controls(sControlName).SpecialEffect = 3
DoEvents

PROC_EXIT:
Exit Sub

PROC_ERR:
MsgBox Err.Description
Resume PROC_EXIT

End Sub
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
2)Επισης εχω βαλει στην βαση μου και την "frm_login" και το module "mdlGeneral".Στο module υπαρχει η function
"Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)" οπου εδω ειναι το προβλημα αν καταλαβα καλα οτι βρισκει 2 ιδια ονομα.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Λυση:

πηγα και αλλαξα την Public Sub Sleep(sngTime As Single) --> Public Sub mySleep(sngTime As Single) και

Public Sub HotSpotClick(sControlName As String)
On Error GoTo PROC_ERR

Me.Controls(sControlName).SpecialEffect = 2
Sleep 1
Me.Controls(sControlName).SpecialEffect = 3
DoEvents...κλπ

---------->> Public Sub HotSpotClick(sControlName As String)[/B]
On Error GoTo PROC_ERR

Me.Controls(sControlName).SpecialEffect = 2
μυSleep 1
Me.Controls(sControlName).SpecialEffect = 3
DoEvents

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Εκανα compile και δεν μου βγαζει το συγκεκριμενο error.
Απάντηση με παράθεση
Απάντηση στο θέμα


Δικαιώματα - Επιλογές
Δε μπορείτε να δημοσιεύσετε νέα μηνύματα
Δε μπορείτε να δημοσιεύσετε απαντήσεις
Δεν μπορείτε να επισυνάψετε αρχεία
Δεν μπορείτε να επεξεργαστείτε τα μηνύματα σας

Ο κώδικας ΒΒ είναι σε λειτουργία
Τα Smilies είναι σε λειτουργία
Ο κώδικας [IMG] είναι σε λειτουργία
Ο κώδικας HTML είναι εκτός λειτουργίας
Trackbacks are εκτός λειτουργίας
Pingbacks are εκτός λειτουργίας
Refbacks are εκτός λειτουργίας


Παρόμοια Θέματα

Θέμα Δημιουργός Forum Απαντήσεις Τελευταίο Μήνυμα
DLL Error γιώργοςΚ Access - Ερωτήσεις / Απαντήσεις 2 20-11-17 11:25
error anestaki Access - Ερωτήσεις / Απαντήσεις 4 14-09-15 00:17
error msg γιώργοςΚ Access - Ερωτήσεις / Απαντήσεις 0 27-05-14 10:58
[VBA] Compile Error jockey17 Excel - Ερωτήσεις / Απαντήσεις 1 13-05-14 20:45
[Γενικά] Προβλημα με excel 2003 & Windows 8 compile errorin hidden modulo : Modulo 1 ΝΙΚΟΛΑΣ1983 Excel - Ερωτήσεις / Απαντήσεις 8 19-01-13 23:57


Η ώρα είναι 08:10.