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
reCAPTCHA PHP not failing when nothing is entered; works fine when something is entered
Ubuntu - Convert Desktop Hard Drive to Laptop? Just ext4 format and copy all files?
I have a coolmax eSATA drive enclosure with a seagate SATA drive
xp sp2 clients wont log or ping server 2003
manage multiple sites from one admin panel drupal/joomla
accessing VPN while Internet Tethering on iPhone
ASP.NET unable to cast object of type
Pivot Table syntax error
QL420 network setup
Terminal Server client side CD/DVD writing