I have never used LostFocus. Maybe should use AfterUpdate?
What is dteDepDate - a public variable?
I have never used LostFocus. Maybe should use AfterUpdate?
What is dteDepDate - a public variable?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Yes, dteDepDate is a public variable. I have it defined as:
' Date of current Deposit
Public dteDepDate As Date
I'll try AfterUpdate
I tried using
Private Sub Date_AfterUpdate()
but it never gets to this either
Are you sure it doesn't run? Might run and error and kick straight to the error handler. Disable error handler and set a break point in the procedure to debug.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
OK, it works now! I have found that at times I have to exit the application completely and start it up again before some of the changes work. wierd!!!
Make sure the code is associated with the event:
https://baldyweb.com/FirstVBA.htm
Also note that Date is a reserved word, it's the name if a function. Access can get confused so it's better not to be used as a field or control name.
Arg, didn't realize there was another page of replies.
Thanks pbaldy,
I have changed the control name for date on the forms to depdate.
Now I have another problem. When i modify a savings deposit, I display all the deposits and when one of them is double-clicked, I open up another form with that deposit and it's specific data. The form is supposed to have specific data about that savings deposit and in the form design all the fields are there. However, nothing in the "Detail" section of the form shows up, just the header and footer. I looked in the design view and the "Detail" section is set to Visible=Yes and Display When=Always. What am I missing?
That typically happens when there are no records to display and you can't add a new record. Double check your wherecondition.
I don't have a WHERE clause. I'll try adding one
What is the code behind the double click of the item you want to open?
Here's the code that gets executed from a double-click
'------------------------------------------------------------
' Modify Savings Deposit
'
'------------------------------------------------------------
Private Sub ModifySavingsDeposit()
On Error GoTo Err_ModifySavingsDeposit
Dim stDocName As String
Dim stLinkCriteria As String
lngSavingsDepositNumber = Me.[Number]
blnTransRecon = Me.Cleared
dteTransDate = Me.[DepDate]
strSavingsAccount = Me.Account
curTransAmount = Me.Amount
stDocName = "frmShowSavingsDepositEntries"
stLinkCriteria = "[Savings Deposit Number]=" & Me![Number]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ModifySavingsDeposit:
Exit Sub
Err_ModifySavingsDeposit:
MsgBox Err.Description
Resume Exit_ModifySavingsDeposit
End Sub
That's a wherecondition. Use this :
https://www.baldyweb.com/ImmediateWindow.htm
on the stLinkCriteria variable and see if it's what you expect. Also:
https://www.baldyweb.com/wherecondition.htm
In case the data type isn't numeric.
The savings deposit number is numeric and it shows up on the form, but none of the other controls show up and the subform doesn't show up.
In the form_open section I have the following:
Me.[Savings Deposit Number] = lngSavingsDepositNumber
Me.Cleared = blnTransRecon
Me.SvgsDepDate = dteTransDate
Me.[Account] = strSavingsAccount
Me.[Total Amount] = curTransAmount
' Refresh Screen
Me.Refresh
Again, the only thing that shows up is the Savings Deposit Number