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
SBS2008 - Exchange not receiving emails
"404 - File not found" for Default .aspx on IIS 7.5
linux security
All Exchange 2007 email shows internal IP address of ISA server rather than origin address
Raid 1 Rebuild Failed - Adaptec 1210SA
access to css 11503 using GUI
How can I check for an install new updates for Symantec Backup Exec? I have clicked on the Help drop down menu, but don't see any options for updates
XP Pro SP3 on Dell Inspiron 9400 notebook with OCZ SSD: BSOD 0xF4 after resume from standby
show crystal report on vb.net (database : Oracle)
simple math programming question