473,803 Members | 3,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parent Form (based on Query) Write Conflict [Access 2003]

110 New Member
All,

I have a Parent form where the Record Source is a query based on three tables (tblcustomers, tblEquipment, and tblWorkOrders).

The Parent form has a subform based on a 4th table (tblServiceVisi ts). When the code from my subform attempts to update controls on the parent form (i.e. refresh the date to the current date and change the status of the work order) I get a write conflict error.

To clarify, I'm getting the error as soon as the parent form gets the focus back. I believe it is because the the information has not been written to the record when the parent form regains focus.

Is there anything along the lines of:

Me.Parent.SaveR ecord

Many thanks in advance for any insight.

Gunner
Jun 9 '10 #1
4 2039
patjones
931 Recognized Expert Contributor
Can you post the code that you are working with? I'd especially like to see the queries that the parent and sub forms are based on. Thanks.

Pat
Jun 11 '10 #2
dgunner71
110 New Member
Pat - Here is the posted code below - this code is located in the subform with the fields to be updated on the parent form. (I changed from Me.Parent to the code below.)


Private Sub dtDateScheduled _AfterUpdate()

Forms!frmWorkOr ders.Form.txtWo rkOrderStatus = "Open Work Order"
Forms!frmWorkOr ders.Form.dtSta tusDate = Now()

End Sub

I'm not 100% sure how I should post the query - I've include the sql below (this is the Record Contorl Source for the parent form):

SELECT tblWorkOrders.* , tblEquipmentSer viced.*, tblCustomers.*, Switch(tblEquip mentServiced!tx tType="Elliptic al","EL",tblEqu ipmentServiced! txtType="Treadm ill","TR",tblEq uipmentServiced !txtType="Home Gym","HG",tblEq uipmentServiced !txtType="Recum bent Bike","RB",tblE quipmentService d!txtType="Upri ght Bike","UB",tblE quipmentService d!txtType="Step per","ST") AS MType, Switch([txtWorkOrderSta tus]="parts on order - Not Confirmed","Not Confirmed",[txtWorkOrderSta tus]="parts on order - Confirmed","Con firmed",[txtWorkOrderSta tus] Like "*Partially*"," Partially Rc'vd",[txtWorkOrderSta tus]="Stock Parts on Order - Confirmed","SP Confrimed",[txtworkordersta tus]="Stock Parts on Order - Not Confirmed","SP Not Confirmed") AS StatusModifier, IIf(nz([dtPurchaseDate],"MT")<>"MT" ,[dtpurchasedate],IIf([numYearsPurchas e]>0,[numYearsPurchas e] & " Year(s)","None Entered")) AS Bought, IIf([txtSecondaryCon tact] & ""="",[txtFirstName] & " " & [txtLastName],[txtFirstName] & " & " & [txtSecondaryCon tact] & " " & [txtLastName]) AS CustFullName
FROM (tblCustomers INNER JOIN tblEquipmentSer viced ON tblCustomers.nu mCustomerID = tblEquipmentSer viced.numCustom erID) INNER JOIN tblWorkOrders ON tblEquipmentSer viced.numEquipm ent = tblWorkOrders.n umEquipment;

The subform (sfrmServiceTri ps) has a control source of tblServiceTrips .

Thanks again for taking the time to help.

Gunner
Jun 12 '10 #3
dgunner71
110 New Member
Pat - I got it working by changing the existing script to that below:


CurrentDb.Execu te "Update tblWorkOrders set [txtWorkOrderSta tus] = 'Open Work Order' where numWorkOrderNo = " & Me.Parent.Form. numWorkOrderNo
CurrentDb.Execu te "Update tblWorkOrders set [dtStatusDate] = '" & Now() & "' where numWorkOrderNo = " & Me.Parent.Form. numWorkOrderNo


I found the code here: http://www.utteraccess.com/forum/Sav...-t1857095.html


The was a DBEngine.Idle dbRefreshCache included after the script, but it did not work properly and does not appear to have an adverse effect by commenting it out.

Thanks again for your help.

Gunner
Jun 13 '10 #4
patjones
931 Recognized Expert Contributor
What you posted for dtDateScheduled _AfterUpdate would not work, because if the controls in question, namely txtWorkOrderSta tus and dtStatusDate are already bound to a recordset, trying to explicitly assign values to those controls would be like trying to edit the record without actually telling Access that you are trying to edit the record. Thus you get a write conflict error.

However, what you tried next works because in using the SQL UPDATE, you are telling Access that you want to edit the underlying recordset that the form is based on, and it thus allows you to do so.

Anyway, I'm glad you managed to get it sorted out.

Pat
Jun 14 '10 #5

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

Similar topics

2
2667
by: cwhite | last post by:
I'm having problems with a form based query The user makes a selection from a drop box, there are only two choices: Current Former the user makes a choice and clicks the preview report button and it runs the query into the form and nothing appears
5
2046
by: SeanCly10 | last post by:
Hi all. I don't want to sound like a complete idiot here, but I'm somewhat limited in my coding knowledge, and I need some advice and help. I'm working on a database that will eventually be used to hold patient information for research purposes. What I'm trying to do is create a form-based query system that will be easier (and less dangerous) for my future users to use to search the patient information. Let me outline the specifics,...
3
1731
by: billelev | last post by:
hi, Does anyone know how you would select, from a table of data, only the distinct values for one field that always appear with each value in a second field? For example...Suppose the data is the following Field1 Field2 2 a 3 a 4 a
7
6217
by: dscarbor | last post by:
I have a simple form with 4 fields, and a subform that retrieves records that are potential matches based on a query. The user will use the ID from the subform record and enter it into one of the fields on the main form (this is how the match will be stored). Is there a way using a button/macro to populate the parent form's field with the ID of the subform record that is currently selected? For example, the subform loads 7 records. The...
2
2054
by: eskelies | last post by:
Hello all, I have data, which is separated into account numbers (ie. 10, 20, 30), but it exists in one query. Right now, I have an access macro "transferspreadsheet," which is exporting all the account numbers into one worksheet. My question: How can I go about exporting data from the query into excel, so that each different fund number has it's own worksheet and it's corresponding data? Thank you. Your assistance would be greatly...
7
21220
by: darnnnel | last post by:
I have a form and a subform. The subform is displayed as a datasheet. When a user selects a record on the list, I would like the parent for to show the contents of the record selected. Access 2007, has the built in SplitForm, I am creating a 2003 database. I need something similar to the splitform in access 2003.
5
2448
Dököll
by: Dököll | last post by:
Hey Fans! Perhaps you can help me... I am using MS Access 2003. I have tried a number of things to get rid of the text #Error from appearing on form fields when no data present. Tried the NZ function, also tried the IIF function, told it to give me zero if no data found, so far it seems to lead to nowhere land. What are your thoughts? Hopefully it's not very simple and I missed the boat, hee hee... Thanks for your help!
5
1698
by: iChappy | last post by:
I have a query based off of two fields in an Access form: Fiscal Week (user manual inputs #) & Fiscal Year (combo box defaulted to current year however may select other years) The query is a where query and the criteria is based on the values of the above listed form fields. Here is my delima: If a user types 05 into the Fiscal Week field on the form then the query runs properly; however if a 5 is typed then the query does not process...
1
1619
by: MikeMikerson | last post by:
Hello, I am need to create a subform (no problem) of a form based query (a problem). I need a form that will prompt the user to enter in a name, and the form will then display a query of the persons transactions. The ideal situation would be that the executed query would remain as part of the record because there will be many of these "searches" stored within this form. I have:
5
2892
by: Bugran | last post by:
I am trying to copy a textbox field on a form (which basically contains the body of a letter) into a memo field in a table (Access 2003) for later printing later. Of course Access queries/SQL will not copy that many characters. I have considered breaking the text box into blocked character sets, but it seems there must be an easier method. Thanks so much for your help!
0
9703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10550
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.