Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2007

Tip: Looking for answers? Try searching our database.

Query table not updating as expected

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bg_ie@yahoo.com - 21 May 2007 08:39 GMT
Hi,

I have a table concerning Lab Tests which I present using a form. One
of the fields in this table is called Test Status where the user can
select the status via a combo box. Under this combo I have a label box
which shows a summary of the status for the entire table e.g. OK: 10,
NOT_OK: 1, NOT_TESTED: 5. When the combo box is changed, I issue a
function to change this label. This function does something like this
-

Private Sub UpdateLabelTestScriptStatus()
   Dim recordSetTestSuiteStatus As DAO.Recordset
   Set recordSetTestSuiteStatus = CurrentDb.OpenRecordset("Select *
from qryTestStatusCount")

   captionText = ""

   recordSetTestSuiteStatus.MoveFirst
   firstWhileIteration = True
   Do While Not recordSetTestSuiteStatus.EOF

       If firstWhileIteration <> True Then
           captionText = captionText & ",  "
       Else
          firstWhileIteration = False
       End If

       captionText = captionText &
recordSetTestSuiteStatus.Fields("StatusType") & ": "
       captionText = captionText &
recordSetTestSuiteStatus.Fields("CountOfStatusType")

       recordSetTestSuiteStatus.MoveNext 'move to next record in
recordset
   Loop

   LabelTestScriptStatus.Caption = captionText

End Sub

The problem is that the line -

Set recordSetTestSuiteStatus = CurrentDb.OpenRecordset("Select * from
qryTestStatusCount")

is always returning back the same values. It seems to me that the
table concerned with the query qryTestStatusCount needs to be updated
at the begining of UpdateLabelTestScriptStatus(). If so, how do I do
this?

Thanks for your help,

Barry.
Dirk Goldgar - 21 May 2007 10:28 GMT
> Hi,
>
[quoted text clipped - 45 lines]
> at the begining of UpdateLabelTestScriptStatus(). If so, how do I do
> this?

It's not clear how the form and combo box are related to the results of
qryTestStatusCount, but it may be that you need to force the current
record to be saved before running that query.  You could do that by
executing

   Me.Dirty = False

after the combo box is updated, before you call
UpdateLabelTestScriptStatus().

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

bg_ie@yahoo.com - 21 May 2007 13:28 GMT
> Innews:1179733183.455776.51930@n15g2000prd.googlegroups.com,
>
[quoted text clipped - 65 lines]
>
> - Visa citerad text -

Excellent, that was my problem thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.