PC Review


Reply
Thread Tools Rate Thread

Update not immediate?

 
 
Reggie Laffond
Guest
Posts: n/a
 
      18th Mar 2004
My application starts on a continuous form that lists names of people who
need to be called. Its control source is a query that selects only records
where the yes/no field named "complete" is valued No. When a record is
selected (by clicking a command button on the desired row) a single record
form is opened displaying only the record selected on the continuous form
and the continuous form is closed in code. After the user finishes the call
the user clicks a command button on the single form indicating that the call
has been made. In code I open a recordset, seek the record being displayed,
edit the recordset, set the yes/no field "complete" to Yes and update the
recordset. Then I close the recordset object, close the database object,
close the single form and open the continuous form.

Set db = CurrentDB
Set rs = db.OpenRecordset("tblAll", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.txtAccount
If Not rs.NoMatch Then
rs.Edit
rs.Fields("Complete") = True
rs.Update
End If
rs.Close
db.Close
DoCmd.Close , "frmSingleRecord"
DoCmd.OpenForm "frmListRecords"

When "frmListRecords" opens, the record that I just updated the "complete"
field to Yes is displayed but shouldn't because the query that feeds it has,
as part of its criteria, that "complete" must be No. If I close the
continuous form and open it 2 seconds later the record in question does not
display (and it should not).

It almost seems that after the single form updates the "complete" field to
Yes, the continuous form opens too quickly before the update is actually
finished.

Is that possible? Is there a way I can wait until the update is finished
before opening my continuous for?

Thanks in advance.


 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      18th Mar 2004
So, frmListRecords is the continous form? I see it being
opened, but never closed first. I would change your code
to this:

CurrentDB.Execute "Update tblAll Set Complete = True where
AccountNbr = " & Me.txtAccount
'Or, if AccountNbr is a text field
'CurrentDB.Execute "UPdate tblAll Set Complete = True
where AccountNbr = '" & Me.txtAccount & "'"
DoCmd.Close acForm, "frmSingleRecord"
Forms("frmListRecords").Requery


Chris



>-----Original Message-----
>My application starts on a continuous form that lists

names of people who
>need to be called. Its control source is a query that

selects only records
>where the yes/no field named "complete" is valued No.

When a record is
>selected (by clicking a command button on the desired

row) a single record
>form is opened displaying only the record selected on the

continuous form
>and the continuous form is closed in code. After the user

finishes the call
>the user clicks a command button on the single form

indicating that the call
>has been made. In code I open a recordset, seek the

record being displayed,
>edit the recordset, set the yes/no field "complete" to

Yes and update the
>recordset. Then I close the recordset object, close the

database object,
>close the single form and open the continuous form.
>
> Set db = CurrentDB
> Set rs = db.OpenRecordset("tblAll", dbOpenTable)
> rs.Index = "PrimaryKey"
> rs.Seek "=", Me.txtAccount
> If Not rs.NoMatch Then
> rs.Edit
> rs.Fields("Complete") = True
> rs.Update
> End If
> rs.Close
> db.Close
> DoCmd.Close , "frmSingleRecord"
> DoCmd.OpenForm "frmListRecords"
>
>When "frmListRecords" opens, the record that I just

updated the "complete"
>field to Yes is displayed but shouldn't because the query

that feeds it has,
>as part of its criteria, that "complete" must be No. If

I close the
>continuous form and open it 2 seconds later the record in

question does not
>display (and it should not).
>
>It almost seems that after the single form updates

the "complete" field to
>Yes, the continuous form opens too quickly before the

update is actually
>finished.
>
>Is that possible? Is there a way I can wait until the

update is finished
>before opening my continuous for?
>
>Thanks in advance.
>
>
>.
>

 
Reply With Quote
 
 
 
 
TC
Guest
Posts: n/a
 
      19th Mar 2004
First, you definitely should not do the db.Close. You did not .Open that
database reference, you definitely should not .Close it.

As for the actual problem, I'd be wondering whether the continuous form is
>actually< closing. Looking at the code you have quoted, it is clear that

you are happy to close the executing form, but then proceed with further
statements. Are you sure the continuous form does not close itself, but then
proceed with further statements? In that case, maybe when the single form
re-opens it, it is actually already open - hence the query has not refreshed
from the table.

If that doesn't help, perhaps a Requery in form_load? (though I'd be
surprised if that fixed it)

HTH,
TC


"Reggie Laffond" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> My application starts on a continuous form that lists names of people who
> need to be called. Its control source is a query that selects only records
> where the yes/no field named "complete" is valued No. When a record is
> selected (by clicking a command button on the desired row) a single record
> form is opened displaying only the record selected on the continuous form
> and the continuous form is closed in code. After the user finishes the

call
> the user clicks a command button on the single form indicating that the

call
> has been made. In code I open a recordset, seek the record being

displayed,
> edit the recordset, set the yes/no field "complete" to Yes and update the
> recordset. Then I close the recordset object, close the database object,
> close the single form and open the continuous form.
>
> Set db = CurrentDB
> Set rs = db.OpenRecordset("tblAll", dbOpenTable)
> rs.Index = "PrimaryKey"
> rs.Seek "=", Me.txtAccount
> If Not rs.NoMatch Then
> rs.Edit
> rs.Fields("Complete") = True
> rs.Update
> End If
> rs.Close
> db.Close
> DoCmd.Close , "frmSingleRecord"
> DoCmd.OpenForm "frmListRecords"
>
> When "frmListRecords" opens, the record that I just updated the "complete"
> field to Yes is displayed but shouldn't because the query that feeds it

has,
> as part of its criteria, that "complete" must be No. If I close the
> continuous form and open it 2 seconds later the record in question does

not
> display (and it should not).
>
> It almost seems that after the single form updates the "complete" field to
> Yes, the continuous form opens too quickly before the update is actually
> finished.
>
> Is that possible? Is there a way I can wait until the update is finished
> before opening my continuous for?
>
> Thanks in advance.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot update, the automatic update is not in services.msc and saysit is when try to install receive this error when trying to automatic update Cornholis Windows XP Basics 2 27th Aug 2011 06:59 AM
Can not install DEFENDER: "a required update to windows update is available at the windows update website" wizzywiz Windows XP General 1 1st Jul 2006 08:40 PM
Re: Software update incomplete, Windows Update software did not update Hilary Karp Windows XP General 0 22nd Jul 2004 03:30 AM
Re: Software update incomplete, Windows Update software did not update Hilary Karp Windows XP General 0 22nd Jul 2004 02:20 AM
Critical Update (kb824105) patch does not install from windows update Matthew Bedford Windows XP Security 0 16th Oct 2003 04:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:00 AM.