×
יריב החביב
Helo,
We have a form that it take a very long time to open (more then 20 second's)
I will be grateful if sombody can take a look and see if i have done
somthing wrong.
the form have more then 20 command option's to run append query's to table's,
so for each table we put textbox wich show (vba code) if the table is alredy
full with
the data of the month that we want to load.
here is the code that we write :
Private Sub Form_Open(Cancel As Integer)
Me.monthfort.DefaultValue = """" & DMax("[f23]", "for_netoonim") & """"
Dim MaxDate As String
Dim MaxDate1 As Integer
Dim MaxDate2 As Integer
Dim MaxDate3 As Integer
Dim MaxDate4 As String
Dim MaxDate5 As String
Dim MaxDate6 As String
Dim MaxDate7 As String
Dim MaxDate8 As String
Dim MaxDate9 As String
Dim MaxDate10 As String
combodate = Me.monthfort
MaxDate = DMax("sacharmonth", "netoonim")
MaxDate1 = DCount("[f23]", "Qnetoonim_machlakot_v")
MaxDate2 = DCount("[f23]", "Qnetoonim_meamamnim_v")
MaxDate3 = DCount("[f23]", "Qnetoonim_shearootim_v")
MaxDate4 = DMax("sacharmonth", "netoonim1")
MaxDate5 = DMax("sacharmonth", "netoonim_mahlaka")
MaxDate6 = DMax("sacharmonth", "netoonim_memamen")
MaxDate7 = DMax("sacharmonth", "netoonim_sheroot")
MaxDate8 = DMax("sacharmonth", "netoonim2")
MaxDate9 = DMax("sacharmonth", "netoonim_mahlaka2")
MaxDate10 = DMax("sacharmonth", "netoonim_memamen2")
paar = DateDiff("m", combodate, MaxDate8)
If paar < 2 Then
Text100.Value = ""
Else
Text100.Value = "warning"
End If
If DateDiff("m", MaxDate, combodate) < 1 Then
Text68.Value = "full"
Else
Text68.Value = ""
End If
If DateDiff("m", MaxDate4, combodate) < 1 Then
Text66.Value = "full"
Else
Text66.Value = ""
End If
If DateDiff("m", MaxDate5, combodate) < 1 Then
Text57.Value = "full"
Else
Text57.Value = ""
End If
If DateDiff("m", MaxDate6, combodate) < 1 Then
Text60.Value = "full"
Else
Text60.Value = ""
End If
If DateDiff("m", MaxDate7, combodate) < 1 Then
Text63.Value = "full"
Else
Text63.Value = ""
End If
If DateDiff("m", MaxDate8, combodate) < 1 Then
Text75.Value = "full"
Else
Text75.Value = ""
End If
If DateDiff("m", MaxDate9, combodate) < 1 Then
Text69.Value = "full"
Else
Text69.Value = ""
End If
If DateDiff("m", MaxDate10, combodate) < 1 Then
Text71.Value = "full"
Else
Text71.Value = ""
End If
End Sub
We have a form that it take a very long time to open (more then 20 second's)
I will be grateful if sombody can take a look and see if i have done
somthing wrong.
the form have more then 20 command option's to run append query's to table's,
so for each table we put textbox wich show (vba code) if the table is alredy
full with
the data of the month that we want to load.
here is the code that we write :
Private Sub Form_Open(Cancel As Integer)
Me.monthfort.DefaultValue = """" & DMax("[f23]", "for_netoonim") & """"
Dim MaxDate As String
Dim MaxDate1 As Integer
Dim MaxDate2 As Integer
Dim MaxDate3 As Integer
Dim MaxDate4 As String
Dim MaxDate5 As String
Dim MaxDate6 As String
Dim MaxDate7 As String
Dim MaxDate8 As String
Dim MaxDate9 As String
Dim MaxDate10 As String
combodate = Me.monthfort
MaxDate = DMax("sacharmonth", "netoonim")
MaxDate1 = DCount("[f23]", "Qnetoonim_machlakot_v")
MaxDate2 = DCount("[f23]", "Qnetoonim_meamamnim_v")
MaxDate3 = DCount("[f23]", "Qnetoonim_shearootim_v")
MaxDate4 = DMax("sacharmonth", "netoonim1")
MaxDate5 = DMax("sacharmonth", "netoonim_mahlaka")
MaxDate6 = DMax("sacharmonth", "netoonim_memamen")
MaxDate7 = DMax("sacharmonth", "netoonim_sheroot")
MaxDate8 = DMax("sacharmonth", "netoonim2")
MaxDate9 = DMax("sacharmonth", "netoonim_mahlaka2")
MaxDate10 = DMax("sacharmonth", "netoonim_memamen2")
paar = DateDiff("m", combodate, MaxDate8)
If paar < 2 Then
Text100.Value = ""
Else
Text100.Value = "warning"
End If
If DateDiff("m", MaxDate, combodate) < 1 Then
Text68.Value = "full"
Else
Text68.Value = ""
End If
If DateDiff("m", MaxDate4, combodate) < 1 Then
Text66.Value = "full"
Else
Text66.Value = ""
End If
If DateDiff("m", MaxDate5, combodate) < 1 Then
Text57.Value = "full"
Else
Text57.Value = ""
End If
If DateDiff("m", MaxDate6, combodate) < 1 Then
Text60.Value = "full"
Else
Text60.Value = ""
End If
If DateDiff("m", MaxDate7, combodate) < 1 Then
Text63.Value = "full"
Else
Text63.Value = ""
End If
If DateDiff("m", MaxDate8, combodate) < 1 Then
Text75.Value = "full"
Else
Text75.Value = ""
End If
If DateDiff("m", MaxDate9, combodate) < 1 Then
Text69.Value = "full"
Else
Text69.Value = ""
End If
If DateDiff("m", MaxDate10, combodate) < 1 Then
Text71.Value = "full"
Else
Text71.Value = ""
End If
End Sub