Microsoft
Software
Hardware
Network
Question : Access Coding
Hi Experts,
I'm having a problem with my coding. attach is the Address form that I'm working and having problem on it. the default value for the Status is set to "M" which is the mailing. when there is an existing mailing address and I enter a new address, then the existing mailing will be change to previous and the new one I just entered will be show as Mailing, this part works fine, however, when there is no existing mailing address instead there is a existing Alternate address, when I enter a new address, of course the new address will automic show as Mailing but the existing Alternate address did not change to previous, I need to make the existing Alternate address atuomic change to show previous in the status. can anyone help? below is my code. thanks
Private Sub Form_AfterUpdate()
Dim rs2 As Recordset
Dim Criteria As String
Dim rs As DAO.Recordset
Dim type_M As Integer
Dim type_A As Integer
HoldAddrType = Me.ADRSTATUS
HoldAddrCntField = Me.ADDRCNT
Me.Requery
Select Case HoldAddrType
Case "M", "A"
Set rs = Me.RecordsetClone
rs.MoveLast
rs.MoveFirst
Do Until rs.EOF
If rs!ADRSTATUS = HoldAddrType And rs!ADDRCNT <> HoldAddrCntField Then
rs.Edit
rs!ADRSTATUS = "P"
rs!ADRUPDT = Now()
rs!ADRUSR = Environ("User")
rs.Update
End If
rs.MoveNext
Loop
Criteria = "Select * from qryAddrP where ADRRIN = '" & Me.ADRRIN & "'"
Set rs = CurrentDb.OpenRecordset(Cr
iteria, dbOpenDynaset, dbSeeChanges)
If Not rs.EOF Then
rs.MoveLast
rs.MoveFirst
Do Until rs.RecordCount < 4
rs.Edit
rs.Delete
rs.MoveNext
Loop
End If
Set rs = Nothing
End Select
Me.Requery
1:
Attachments:
Address.doc
(126 KB)
(File Type Details)
Address form
Answer : Access Coding
I don't think you need to EDIT before DELETE
Do Until rs.RecordCount < 4
rs.Edit '--- I don't think this is necessary ----
rs.Delete
rs.MoveNext
Scott C
Random Solutions
which is the best website to learn stored procedure ??
SSG5 VPN Routing, internal LAN route works, VPN route doesnt.
Crystal Reports Xi - Sorting a CrossTab Report by a Summary Field
Best Website to Collect Photos
Pass URL Parameter to multiple iFrames in ASP
Google Chart corechart help
Cisco 2950 Vlan for Voice
How to restrict incoming RDP on a Windows XP PC from a particular WAN IP ?
Symantec Endpoint Protection - SID 23615 HTTPS Tidserv Request 2 Detected
Report ot few records