empty form

mana

Registered User.
Local time
Today, 06:51
Joined
Nov 4, 2014
Messages
265
hello

i have a button in a form that i wrote the below code in it and then based on two date text boxes a form will be APPEARED. when there are related dates within the query they will be shown but when there are not related data the form will be completely empty. do you know why? can you help me please? i also attached the difference between status of my form . i want that just the data of the form will be empty but my text boxes and buttons won't be disappeared. thank you



Code:
Dim vAdmin_Flag As Boolean
    Dim vAnalyser_Flag As Boolean
    Dim vReadOnly_Flag As Boolean
        
    If Get_Bearbeiter_Detail(fOSUserName, , vReadOnly_Flag, vAnalyser_Flag, vAdmin_Flag) = True Then
        If vAdmin_Flag = True Or vAnalyser_Flag = True Then
            DoCmd.OpenForm "frm_Bearbeiten_I_FAST", , , "Datum_Bewegung BETWEEN #" & Replace(Format(Me.txt_StartDate.Value, "mm/dd/YYYY"), ".", "/") & "# " & _
                                                                     "AND #" & Replace(Format(Me.txt_EndDate.Value, "mm/dd/YYYY"), ".", "/") & "#"
        ElseIf vReadOnly_Flag = True Then
            DoCmd.OpenForm "frm_Bearbeiten_I_FAST", , , "Datum_Bewegung BETWEEN #" & Replace(Format(Me.txt_StartDate.Value, "mm/dd/YYYY"), ".", "/") & "# " & _
                                                                     "AND #" & Replace(Format(Me.txt_EndDate.Value, "mm/dd/YYYY"), ".", "/") & "#"
            [Forms]![frm_Bearbeiten_I_FAST]![Bereich].Enabled = False
            [Forms]![frm_Bearbeiten_I_FAST]![Prozess].Enabled = False
            [Forms]![frm_Bearbeiten_I_FAST]![Ursache].Enabled = False
            [Forms]![frm_Bearbeiten_I_FAST]![Kommentar].Enabled = False
            [Forms]![frm_Bearbeiten_I_FAST]![Status].Enabled = False
            [Forms]![frm_Bearbeiten_I_FAST]![Verantwortlicher].Enabled = False
            [Forms]![frm_Bearbeiten_I_FAST]![btn_TeilenummerGeschichte].Enabled = False
            [Forms]![frm_Bearbeiten_I_FAST]![btn_Ursachenanalysen].Enabled = False
            [Forms]![frm_Bearbeiten_I_FAST]![btn_ÜbernehmenFürAlle].Enabled = False
        End If
    Else
        MsgBox "Sie sind leider nicht berechtigt diese Funktion auszuführen!", vbCritical
        DoCmd.Close acForm, "frm_Bearbeiten_I_FAST"
    End If
 

Attachments

  • Unbenannt.jpg
    Unbenannt.jpg
    88.4 KB · Views: 77
  • Unbenannt1.jpg
    Unbenannt1.jpg
    64.4 KB · Views: 73
A form will do that if it returns no records and doesn't allow new records. One way around it would be to test using DCount() and the same criteria, and only open the form if it will have records.
 

Users who are viewing this thread

Back
Top Bottom