Please help - Write Conflict

Jackpotgee

Registered User.
Local time
Today, 00:13
Joined
Jun 7, 2007
Messages
27
Hi, i know there are about 700 posts on here regarding write conflicts but i have searched them all and cant get this to work.

Code:
Private Sub OrgansiationSendingReferral_AfterUpdate()

DoCmd.SetWarnings False

Dim stDocNameRec As String
Dim stDocNameSen As String

stDocNameRec = "Mcr_UpdateHQReceiving"
stDocNameSen = "Mcr_UpdateHQSending"

DoCmd.OpenQuery "Qry_ReferralCodeClear"

If [ToFrom/HS] = "F" Then GoTo Receiving
If [ToFrom/HS] = "T" Then GoTo Sending


Receiving:

If [HSOfficeReceivingReferral] Like "KPMG" Or [HSOfficeReceivingReferral] Like "HS*" Or [HSOfficeReceivingReferral] Like "*LLP" Or [HSOfficeReceivingReferral] Like "UBS" Or [HSOfficeReceivingReferral] Like "RBS" Or [HSOfficeReceivingReferral] Like "BNP*" Then GoTo Exit_HSOfficeReceivingReferral_AfterUpdate Else

[HSOfficeReceivingReferral] = StrCon ([HSOfficeReceivingReferral], vbProperCase)

Exit_HSOfficeReceivingReferral_AfterUpdate:
    DoCmd.RunMacro stDocNameRec

    Exit Sub

Sending:
If [OrgansiationSendingReferral] Like "KPMG" Or [OrgansiationSendingReferral] Like "HS*" Or [OrgansiationSendingReferral] Like "*LLP" Or [OrgansiationSendingReferral] Like "UBS" Or [OrgansiationSendingReferral] Like "RBS" Or [OrgansiationSendingReferral] Like "BNP*" Then GoTo Exit_OrgansiationSendingReferral_AfterUpdate Else

[OrgansiationSendingReferral] = StrConv([OrgansiationSendingReferral], vbProperCase)
    
Exit_OrgansiationSendingReferral_AfterUpdate:


    DoCmd.RunCommand acCmdRefreshPage

    DoCmd.RunMacro stDocNameSen
    
[COLOR="Red"]    DoCmd.OpenQuery "Qry_ReferralCodeClear"
    
    DoCmd.OpenQuery "Qry_ReferralCodeUpdate"
    
    DoCmd.OpenQuery "Qry_ReferralCodeUpdateOther"[/COLOR]

[COLOR="SeaGreen"]    DoCmd.RunCommand acCmdRefreshPage
    
    DoCmd.RunCommand acCmdSaveRecord[/COLOR]
    
DoCmd.SetWarnings True

    Exit Sub


Ive tried all sorts of save record functions but cant get this to work(Green).
It was working fine until i added the bits in red. These 3 queries update a field called referral code based on the information that is supplied in OrganisationSendingReferral.

The Macros update a different field also based on which firm is selected in OrganisationSendingReferral.

OrganisationSendingReferral is a combo box that runs on a query.

Hope this is enough! i am literally at my wits end!
 
do you have your open form on the record you are trying to update?
 
Hi yes, the form is open when i am trying to update the record.


Cheers
 
Last edited:
All fixed now, Finally, so simple as well.

just surrounded the first query with a save and a refresh and it now works fine.

Code:
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenQuery "Qry_ReferralCodeClear"
DoCmd.RunCommand acCmdRefresh
 
Could this work for me. My post is on Forms forum, and exactly the same issue - although my SQL/Query is on another form which updates just one field in the current record on the subform, on it's Form_Unload event.. ?
 

Users who are viewing this thread

Back
Top Bottom