Date Validation

german

Registered User.
Local time
Today, 14:16
Joined
Jul 5, 2012
Messages
21
Hi everybody

I thank mr john and others for helping me in the last post.

Once again i am here to disturb u.

Can you help to solve this issue

i have a form which contains the item details for the particular period.it has a field called opening balance which fetches the closing qty from the previous entry.i face problem while editing the previous record because it takes last closing qty.

the code is as follows


Private Sub openingbalance_GotFocus()
Call test
End Sub

Private Sub test()
Dim sql As String
Dim con As DAO.Connection
Dim rs As DAO.Recordset
Dim st, fm, itemid As Integer
Dim lfm, qty As Double
Dim dateto As Date

itemid = Forms!smptest![Partyname]
dateto = Forms!smptest!dateto
sql = "SELECT t1.Partyname, t1.Closingqty AS closing,t1.dateto as dateto FROM t1 WHERE (((t1.Partyname) = " & itemid & "))GROUP BY t1.Partyname, t1.Closingqty,t1.dateto having (t1.dateto<" & dateto & ")"
Set rs = CurrentDb.OpenRecordset(sql)
'Do While Not rs.EOF
If rs.RecordCount > 0 Then
rs.MoveLast

lfm = rs("closing")
Forms!smptest!openingbalance.SetFocus
'MsgBox lfm
Forms!smptest!openingbalance = lfm
Else
Forms!smptest!openingbalance.SetFocus
Forms!smptest!openingbalance = 0
'End If
'rs.MoveNext
'st = "TripReport"
'Loop
'DoCmd.OpenReport st
'
'Loop
End If
End Sub


i want to compare the date how can i do this?

Thanks in advance
 
In a properly normalized table, no row is dependent on any other row. Calculate the opening balance as you need it. If you decide you need to store the balance, use a separate table. You will need to prevent updates to the detail table that affect records "prior" to the latest opening balance in the balance table. Trying to manage a running balance in a table where the records can be updated is a nightmare and you won't be able to do it with queries, you'll need a code loop to update the balance on all affected records.
 
Can you help me to do the coding part?

it would be better if u give me some example.

i am new to the coding part .
 

Users who are viewing this thread

Back
Top Bottom