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
How Can I Downgrade my VMWare Fusion for Mac?
do you know a function like $notes = nl2br( $_POST['notes'] ); in ASP?
What is the next number of this number sequence? - General Math Question
Access Table to Excel Spreadsheet
Blackberry browser 400 error - socketexception Connection reset
IE sometimes fails to connect, gets worse with time since reboot
Teamview Business alternatives
How To Check Packets for Urls
HP Laptop w/ Vista freezing regularly
Do I need to Install ACT on every server before installing Act Network sync?