Form not saving from VB action

Fijian

Registered User.
Local time
Today, 17:26
Joined
Sep 22, 2005
Messages
32
Hi,

On my Form I have a Label (Recnote) which gets changed by the VB code if criterior is true. My form does change this correctly however, once I quit (or close the Form) and come back, the changes dissappear.

But the strange thing is that every now and then it does save it.

Any ideas??? Any other command I should use?

The following works as it disables my Import button and changes the Label contents but does not save when exited

Code:
Private Sub CloseME_Click()
DoCmd.Requery

If [CountOfOracle Co] = 0 Then
MsgBox "Cannot Close ME Yet", vbOKOnly, "Circular Rec"
Else


Me.Recnote.BackColor = 65535
Me.Recnote.Caption = "Final Reconciliation"
Me.Recnote.ForeColor = 32768
Me.Import.Enabled = False
DoCmd.RepaintObject
DoCmd.Save
End If

End Sub
Code:
 
Try putting the following in the Current event of your form instead.
Code:
If [CountOfOracle Co] <> 0 Then
   Me.Recnote.BackColor = 65535
   Me.Recnote.Caption = "Final Reconciliation"
   Me.Recnote.ForeColor = 32768
   Me.Import.Enabled = False
End If
 
Last edited:
Thx. It has worked, I hope not temperamental like before.
 
You will need to put similar code in the AfterUpdate event of the [CountOfOracle Co] control.
 
Hi Rural Guy,

Sorry. I missed a part.

The Label changes to "Interim Reconciliation" as well and a result Current event will give me incorrect value. The [CountOfOracle Co] has to have a value for "Interim Reconciliation" to work.

Private Sub Import_Click()
Me.Recnote.BackColor = 39423
Me.Recnote.Caption = "Interim Reconciliation"
DoCmd.RepaintObject
DoCmd.Save
DoCmd.OpenForm "ImportCheck", acNormal
End Sub
 
Start by commenting out these lines. I doubt you need them anywhere.
Code:
DoCmd.RepaintObject
DoCmd.Save
So your form's sequence is controlled by Command Buttons? Do you want to Enable/Disable buttons depending on the contents of the [CountOfOracle Co] control? I don't quite understand the logic flow of your form yet.
 
The flow is as follows:

The Form opens with Recnote "Rec not Available"

Once the user (imports the files) clicks Import_Click button (hence the Sub), it changes to "Interim Reconciliation".

After other updates etc, when the user is happy, they press the CloseME_Click().

The Msg in CloseME_Click() is just incase the user presses the button without importing the files - If they don't import then the [CountOfOracle Co] will be null therefore, [CountOfOracle Co] does not play a relevant part but informs user they can't Close ME because files have not been imported.

If that makes sense?
 
Then you are going to want to keep your button code. Just eliminate the two lines I showed you in post # 6.
 
Thx. I will do that and test to see if all works fine.

Cheers
 
Hi,

It still doesn't work.

I have also added an unbound Text box and once you type something it will stay there but as soon as you exit and come back, it goes.

Even though I have taken away the commands mentioned in #6, I still have the same problem and I cannot put the command in #2 as it will not work for other bits.

Any ideas??

Thx
 
We seem to be going around in circles. Any chance you can post your zipped up db?
 
I have only put the relevant Forms as it is a huge dbase. This is enough to show the prob.
 

Attachments

I didn't see the problem but I made a couple of changes.
 

Attachments

I am sorry but it did not make any changes.

My problem is:

1. When I type a date, it remains whilst I am in it and it dissappears when I close and come back in. It becomes blank again. It does not save changes.

2. Same with the **Close Month End** button. It does what it should but when you close/exit and come back it goes back to original. (I mean "Final Reconciliation" on Label Recnote dissappears. "Reconciliation not Available Yet" comes back. It does not save changes.

3. Same with the **Import...** button. It does what it should but when you close/exit and come back it goes back to original. (I mean Interim Reconiliation on Label recnote dissappears). This one does change but sometimes only.

I hope you are replicating the same prob.

Thanks
 
AhhHaaa...he said [slapping his forehead].
Unless there is something inherent in the data to let you know the state of the reconsiliation process you will need a separate table with a record to keep track of the current process. Forms are simply windows into tables and by themselves contain no data.
 

Users who are viewing this thread

Back
Top Bottom