A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

form keeps calculating



 
 
Thread Tools Display Modes
  #1  
Old August 20th, 2008, 05:33 PM posted to microsoft.public.access.forms
ragtopcaddy via AccessMonster.com
external usenet poster
 
Posts: 67
Default form keeps calculating

I have the following code behind several after update events as well as form
current:

Function StoreCtls()
Dim blTorF As Boolean
Dim nBrand As Integer
Dim qdf As DAO.QueryDef
Dim strSQL As String
Dim strSelect As String
Dim strAnd As String
Dim strGroupBy As String
Dim strOrderBy As String
Dim rsATLOS As DAO.Recordset
Dim blATLOS As Boolean
Dim strPrftPct As String

Set qdf = dbLocal.QueryDefs("qryMktsCombo")

strSelect = "SELECT qryStoreMaster.[Market#], [Market Name], MktNm" & vbCrLf
strSelect = strSelect & "FROM qryStoreMaster" & vbCrLf
strSelect = strSelect & "WHERE Not qryStoreMaster.[Market#] Is Null"
strAnd = " AND Brand="
strGroupBy = vbCrLf & "GROUP BY qryStoreMaster.[Market#], [Market Name],
MktNm" & vbCrLf
strOrderBy = "ORDER BY qryStoreMaster.[Market#]"

With Me
blTorF = (Nz(.grpBrands, 0) = 0 And Nz(.grpPrftsOvrUnd, 0) = 0 And Nz(.
grpSlsOvrUnd, 0) = 0 _
And Nz(.cmbMarket, 0) = 0) And Nz(.grpProfit_, 0) = 0
.cmbStores.Visible = blTorF
.txtStoreBrand.Visible = blTorF
.txtStoreCityST.Visible = blTorF
.txtStoreDesc.Visible = blTorF
nBrand = .grpBrands
End With

Select Case nBrand
Case 0
strAnd = ""
Case 1
strAnd = strAnd & """ATS"""
Case 2
strAnd = strAnd & """ATF"""
Case 3
strAnd = strAnd & """ATL"""
Case 4
strAnd = strAnd & """ATLOS"""
End Select

With Me
.txtOver = 0
.txtUnder = 0
Select Case .grpProfit_
Case 0
.txtOver.Visible = False
.txtUnder.Visible = False
Case 1
.txtOver.Visible = True
.txtUnder.Visible = False
Case 2
.txtOver.Visible = False
.txtUnder.Visible = True
Case 3
.txtOver.Visible = True
.txtUnder.Visible = True
End Select
End With

qdf.SQL = strSelect & strAnd & strGroupBy & strOrderBy

'strSQL = "SELECT Brand FROM qryStoreMaster WHERE Not [Market#] Is Null AND
Sales""0"" AND Profits""0"" AND Brand=""ATLOS"""
strSQL = "SELECT BrandCode" & vbCrLf
strSQL = strSQL & "FROM (tblBrands INNER JOIN tblStoreMaster ON tblBrands.
BRANDID = tblStoreMaster.brandid)"
strSQL = strSQL & " INNER JOIN qryLTMSales ON tblStoreMaster.[Store #] =
qryLTMSales.[Store #]" & vbCrLf
strSQL = strSQL & "WHERE BrandCode=""ATLOS"" AND Not [Market#] Is Null AND
LTMSls0"

Set rsATLOS = dbLocal.OpenRecordset(strSQL)
blATLOS = Not rsATLOS.EOF

With Me
With .cmbMarket
.RowSource = .RowSource
.Requery
End With
.optATLOS.Enabled = blATLOS
End With

rsATLOS.Close

Set rsATLOS = Nothing

End Function

Can anyone tell me why the form keeps recalculating? What workaround would
you suggest?

Thanks,

Bill

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200808/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.