D
David McKnight
I have a few question on how I might improve the partial code below:
1) How do I format the text box txtTotaltime so that it will display the
time in days,hrs, min, seconds. If I format it in long time it displays as
reference from 12:00:00 AM- this is not what I want?
2) In my SELECT FROM WHERE statement I want to select between season based
on input textboxes txtSeason.Value & txtEndSeason.Value instead of how I have
below which is a static value (2005). How can I do this? I've tried useing
WHERE [111 Avg Adjusted Margin].[Season] >=txtSeason.Value" and other
modification but I alway get a error such as missing parameter. Any Ideas?
txtTimeStart.Value = Now
Loops = txtLoops.Value
EndSeason = txtEndSeason.Value
BeginSeason = txtSeason.Value
txtTimeFinished.Value = Now
txtTotalTime.Value = txtTimeFinished.Value - txtTimeStart.Value
Text_LoopNo.Value = "Starting"
Me.Repaint
DoEvents
If (IsNull(Me.txtSeason) Or IsNull(Me.txtEndSeason)) Then
MsgBox "Both years required."
Else
strSql = "DELETE * FROM [111 Avg Adjusted Margin DB]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "INSERT INTO [111 Avg Adjusted Margin DB] SELECT [111 Avg
Adjusted Margin].* FROM [111 Avg Adjusted Margin] WHERE [111 Avg Adjusted
Margin].[Season] >=2005"
CurrentDb.Execute strSql, dbFailOnError
3) Lastly in the code below I try to limit the number of Loops by using a
input value from a text box on the form. However I can never get it work as
it loops endlessly ( I believe) when I use the code below verses having an
actual value such as 100. I assume I'm not referencing the txtLoops.Value
correctly in the code as maybe be the case above?
counter = 0
myNum = 0
Do
myNum = myNum + 1
Text_LoopNo.Value = myNum
Me.Repaint
DoEvents
strSql = "DELETE * FROM [153 Quality Scores Union Query DB]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "INSERT INTO [153 Quality Scores Union Query DB] SELECT [153c
Quality Scores].* FROM [153c Quality Scores]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "DELETE * FROM [143 Quality Scores Union Query DB]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "INSERT INTO [143 Quality Scores Union Query DB] SELECT [153
Quality Scores Union Query DB].* FROM [153 Quality Scores Union Query DB]"
CurrentDb.Execute strSql, dbFailOnError
txtTimeFinished.Value = Now
txtTotalTime.Value = txtTimeFinished.Value - txtTimeStart.Value
Me.Repaint
DoEvents
counter = counter + 1
Loop Until myNum = txtLoops.Value
1) How do I format the text box txtTotaltime so that it will display the
time in days,hrs, min, seconds. If I format it in long time it displays as
reference from 12:00:00 AM- this is not what I want?
2) In my SELECT FROM WHERE statement I want to select between season based
on input textboxes txtSeason.Value & txtEndSeason.Value instead of how I have
below which is a static value (2005). How can I do this? I've tried useing
WHERE [111 Avg Adjusted Margin].[Season] >=txtSeason.Value" and other
modification but I alway get a error such as missing parameter. Any Ideas?
txtTimeStart.Value = Now
Loops = txtLoops.Value
EndSeason = txtEndSeason.Value
BeginSeason = txtSeason.Value
txtTimeFinished.Value = Now
txtTotalTime.Value = txtTimeFinished.Value - txtTimeStart.Value
Text_LoopNo.Value = "Starting"
Me.Repaint
DoEvents
If (IsNull(Me.txtSeason) Or IsNull(Me.txtEndSeason)) Then
MsgBox "Both years required."
Else
strSql = "DELETE * FROM [111 Avg Adjusted Margin DB]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "INSERT INTO [111 Avg Adjusted Margin DB] SELECT [111 Avg
Adjusted Margin].* FROM [111 Avg Adjusted Margin] WHERE [111 Avg Adjusted
Margin].[Season] >=2005"
CurrentDb.Execute strSql, dbFailOnError
3) Lastly in the code below I try to limit the number of Loops by using a
input value from a text box on the form. However I can never get it work as
it loops endlessly ( I believe) when I use the code below verses having an
actual value such as 100. I assume I'm not referencing the txtLoops.Value
correctly in the code as maybe be the case above?
counter = 0
myNum = 0
Do
myNum = myNum + 1
Text_LoopNo.Value = myNum
Me.Repaint
DoEvents
strSql = "DELETE * FROM [153 Quality Scores Union Query DB]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "INSERT INTO [153 Quality Scores Union Query DB] SELECT [153c
Quality Scores].* FROM [153c Quality Scores]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "DELETE * FROM [143 Quality Scores Union Query DB]"
CurrentDb.Execute strSql, dbFailOnError
strSql = "INSERT INTO [143 Quality Scores Union Query DB] SELECT [153
Quality Scores Union Query DB].* FROM [153 Quality Scores Union Query DB]"
CurrentDb.Execute strSql, dbFailOnError
txtTimeFinished.Value = Now
txtTotalTime.Value = txtTimeFinished.Value - txtTimeStart.Value
Me.Repaint
DoEvents
counter = counter + 1
Loop Until myNum = txtLoops.Value