473,387 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Timing issues with Access & SQL Server again

I'm using Access 2002 as a front end to a SQL Server 2000 database. I Update a status field in a SQL Server table using a parameter based stored proc. Works great. Then in the same sub, I open a popup form to view the record I have just updated.

If I open the Popup Form automatically in code, the status field is not updated. If I open it from a button on the form, it works great.

I have tried every trick I know to force the SQL Server table to be updated before I open the Popup Form, but nothing works. I have tried (1) Doevents, (2) Requerying the Popup Form, (3) Requerying the updated recordset (4) Opening the updated recordset in code.

Any other Suggestions?
Jan 3 '07 #1
11 1622
MMcCarthy
14,534 Expert Mod 8TB
I'm using Access 2002 as a front end to a SQL Server 2000 database. I Update a status field in a SQL Server table using a parameter based stored proc. Works great. Then in the same sub, I open a popup form to view the record I have just updated.

If I open the Popup Form automatically in code, the status field is not updated. If I open it from a button on the form, it works great.

I have tried every trick I know to force the SQL Server table to be updated before I open the Popup Form, but nothing works. I have tried (1) Doevents, (2) Requerying the Popup Form, (3) Requerying the updated recordset (4) Opening the updated recordset in code.

Any other Suggestions?
Don't know the solution offhand Rocky will point some experts in your direction who might.

Mary
Jan 4 '07 #2
NeoPa
32,556 Expert Mod 16PB
As a last resort (because you've already considered most answers I could think of - especially the DoEvents one) can you try using the OnTimer routine.
Open the popup form in the Timer event and trigger the event after, say, a quarter of a second.
A bit of a clumsy work-around, but should reproduce the manual method which is working quite closely.
HTH.
Jan 4 '07 #3
willakawill
1,646 1GB
I'm using Access 2002 as a front end to a SQL Server 2000 database. I Update a status field in a SQL Server table using a parameter based stored proc. Works great. Then in the same sub, I open a popup form to view the record I have just updated.

If I open the Popup Form automatically in code, the status field is not updated. If I open it from a button on the form, it works great.

I have tried every trick I know to force the SQL Server table to be updated before I open the Popup Form, but nothing works. I have tried (1) Doevents, (2) Requerying the Popup Form, (3) Requerying the updated recordset (4) Opening the updated recordset in code.

Any other Suggestions?
Is it possible to see the offending snippet of code?
Jan 4 '07 #4
missinglinq
3,532 Expert 2GB
I know absolutely nothing about writing to a SQL Server backend, but by your description of the problem, it sounds like it's not writing the update to the backend until the focus moves off of wherever it is to the button to open the popup. You might try in VBA moving the focus elsewhere then opening the form from VBA. Won't take but a second to try!
Jan 4 '07 #5
The issue probably is with the type of cursor you opened in the recordset.

I've had this problem myself & found if I replace the recordset.update command with the Recordset.updatebatch coimmand the database is updated immediately. Otherwise the command is not committed unti lyou leave the procedure or close the connection
Jan 4 '07 #6
willakawill
1,646 1GB
The issue probably is with the type of cursor you opened in the recordset.

I've had this problem myself & found if I replace the recordset.update command with the Recordset.updatebatch coimmand the database is updated immediately. Otherwise the command is not committed unti lyou leave the procedure or close the connection
Far too many answers without seeing code.
Don't know if it is dao, ado, odbc, recordset, command object, connection object, server side cursor blah blah blah.
Post the code
Jan 4 '07 #7
NeoPa
32,556 Expert Mod 16PB
Long time no see Andrew.
This sounds like the proper answer to me.
You won't need the timer trick if this works.
Jan 4 '07 #8
Far too many answers without seeing code.
Don't know if it is dao, ado, odbc, recordset, command object, connection object, server side cursor blah blah blah.
Post the code
Here's the code. Remarked out lines are some of the code I have tried to use to resolve this issue.

Expand|Select|Wrap|Line Numbers
  1.    '*******
  2.    ' StoredProc set PositionStatus = Previous and PositionEndDate = @PositionEndDate in EmployeePosition
  3.    ' WHERE PositionStatus = Current and EmployeeID = @EmployeeID
  4.  
  5.    cnn.BeginTrans
  6.    Set cmd = MakeStoredProc("sp_EmployeePosition_UpdatePositionEndDateNStatus_ForEmployeeID")
  7.    Set prmEmployeeID = cmd.CreateParameter("EmployeeID", adInteger, adParamInput, , lngEmployeeID)
  8.    Set prmPositionEndDate = cmd.CreateParameter("PositionEndDate", adDate, adParamInput, , datTermination)
  9.    Set prmModName = cmd.CreateParameter("ModName", adVarChar, adParamInput, 6, gbStrUserCode)
  10.    cmd.Parameters.Append prmEmployeeID
  11.    cmd.Parameters.Append prmPositionEndDate
  12.    cmd.Parameters.Append prmModName
  13.    cmd.Execute
  14.    cnn.CommitTrans
  15.    Set cmd = Nothing
  16.    DoEvents
  17.  
  18. '   Set qryd1 = gbDbsUser.QueryDefs("EmployeePosition_Update1PositionEndDate2Status_ForEmplID_UpdQry")
  19. '   qryd1.Parameters("prmEmployeeID") = lngEmployeeID
  20. '   qryd1.Parameters("prmPositionEndDate") = datTermination
  21. '   qryd1.Parameters("prmModName") = gbStrUserCode
  22. '   qryd1.Execute
  23. '   DoEvents
  24. '   qryd1.Close: Set qryd1 = Nothing
  25.  
  26. '   Set tdfEmployeePosition = gbDbsUser.TableDefs("EmployeePosition")
  27. '   var = RefreshMyLink(tdfEmployeePosition, tdfEmployeePosition.Connect)
  28.  
  29. '   Set cnn = gbCnnDataDB
  30. '   DoEvents
  31.  
  32.    '-- Open VacantPosition_Popup
  33.    MyW = "EmployeeID = " & lngEmployeeID
  34.    var = OpenMyForm("EmployeePosition_TerminateEmployee_Popup", "Popup", "Employee_Entry", MyW)
  35.  
  36.    '-- Confirm End
  37.    myM = "CURRENT EMPLOYEE POSITIONS HAVE BEEN SET TO PREVIOUS. Open the Employee Position Terminate " _
  38.          & "Popup to set the Position to Vacant. "
  39.    Alert
Jan 4 '07 #9
willakawill
1,646 1GB
Here's the code. Remarked out lines are some of the code I have tried to use to resolve this issue.
As I suspected. There is no recordset object. Now would you please post the code for the declarations of the cnn and cmd objects. Thanks
Jan 4 '07 #10
As I suspected. There is no recordset object. Now would you please post the code for the declarations of the cnn and cmd objects. Thanks
Thanks for your help. I found the problem. There was an error in my OpenMyForm Function.
Jan 5 '07 #11
MMcCarthy
14,534 Expert Mod 8TB
Thanks for your help. I found the problem. There was an error in my OpenMyForm Function.
Glad you got it worked out.

Mary
Jan 5 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John Silver | last post by:
I have a perl script running on machine A, a web server. A visitor completes certain pieces of data and these are compiled into two emails, one addressed to the visitor and copied to the site...
3
by: pbbriggs | last post by:
I will try to be as descriptive as possible, but this error has me stumped and I am not sure what relevant info to include.... I am running Access XP on a Windows XP machine. I initially began...
3
by: Jeffrey | last post by:
Good day all, I have seen so many postings dealing with MS Access as a security risk and other items, yet I see now clear reason why. I would really like someone to point me in the right...
4
by: Brian Hanson | last post by:
Hi, I have a problem that is sporadic and am thinking it may come down to a timing issue. I have an asp.net (vb) app that used the system.io.file.copy method to copy a .pdf file from a network...
15
by: Dino Vliet | last post by:
Hi folks, probably this is a question you've heard so many times but I wasn't able to find a solution to it. I'm using a shell script to create a textfile for me. It looks like...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
2
by: Nicolas Le Gland | last post by:
Hello everyone here. This is my first post in this newsgroup, I hope I won't be to much off-topic. Feel free to redirect me to any better group. I am getting strange timing issues when...
0
by: Daniel Fetchinson | last post by:
On 4/15/08, Daniel Fetchinson <fetchinson@googlemail.comwrote: BTW, using the following ###################################################################### # CODE TO TEST BOTH...
4
by: Thomas R. Hummel | last post by:
We are using SQL Server 2005. The SP in question is a fairly simple select statement. When the developers run their unit tests it is timing out (15 second timeout is set from their end). When I run...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.