home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Not accepting duplicates

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1667
Discussions: 200,958, Posts: 2,379,514, Members: 246,328
Old April 10th, 2003, 03:28 PM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Apr 2003
Posts: 2
Unhappy
Not accepting duplicates

I'm working on a VB program that randomly collects records from MS Access. The problem is that it keeps giving me duplicate records. How can I stop this . This is what I have so far, Please help :

Call CNN_Aud

recAudTable.Open "select * FROM T_Aud", cnnAud, adOpenKeyset, adLockOptimistic

If recAudTable.RecordCount > 0 Then
strmonth = recAudTable!Date
strmonth = Format(strmonth, "mmmm")
If strmonth = cmbMonths.Text Then
Beep
MsgBox "Already completed Aud for the month of " & "'" & cmbMonths.Text & "'"
Exit Sub
Else
cnnAud.Execute "delete * from T_Aud"
cnnAud.Execute "delete * from T_Aud_NC"
End If
End If
recAudTable.Close

recAudTable.Open "select * from T_Aud", cnnAud, adOpenKeyset, adLockOptimistic
recPERS.Open "select * from T_Crnt_PERSs", cnnAud, adOpenKeyset, adLockOptimistic

Do Until recPERS.EOF
prg_Aud.Visible = True
prg_Aud.Value = prg_Aud.Value + 1
lblStatus.Caption = "Populating Conts for " & recPERS!Name
DoEvents
recQryAud.Open "select * from q_Aud where Month= " & "'" & cmbMonths.Text _
& "'" & " and Name= " & "'" & recPERS!Name & "'", _
cnnAud, adOpenKeyset, adLockOptimistic
If Not recQryAud.EOF Then
For intCount = 1 To 5
Randomize
lngRandom = Int((Rnd * recQryAud.RecordCount) + 1) - 1
recQryAud.MoveFirst
recQryAud.Move lngRandom, 1
if recqryAud!transid =
recAudTable.AddNew
recAudTable!transid = recQryAud!transid
recAudTable!Date = recQryAud!Date
recAudTable!Time = recQryAud!Time
recAudTable!Name = recQryAud!Name
recAudTable!BUC = recQryAud!BUC
recAudTable!AcNum = recQryAud!AcNum
recAudTable!Status = recQryAud!Status
recAudTable!Ba = recQryAud!Ba
recAudTable!Pre = recQryAud!Pre
recAudTable.Update

Next intCount
End If

recQryAud.Close
recPERS.MoveNext
Loop
lblStatus.Caption = "Done populating Conts."
prg_Aud.Visible = False
recPERS.Close
recAudTable.Close
jaji2000 is offline   Reply With Quote
Old April 10th, 2003, 10:07 PM     #2 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,389
try SELECT DISTINCT * FROM tablename
__________________
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
vass0922 is online now   Reply With Quote
Old April 12th, 2003, 05:24 PM     #3 (permalink)
Junior Member
 
Join Date: Apr 2003
Posts: 2
Thanks!!
jaji2000 is offline   Reply With Quote
Old April 12th, 2003, 05:26 PM     #4 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,389
No worries, and Welcome To TechIMO
vass0922 is online now   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2960)
The disrespect of Obama by Russian .. (41)
Making Health Care Worse (178)
Wireless Televisions. (12)
CPU fan stops spinning randomly (9)
Regular Build (11)
windows 7 problem (7)
Laptop with wireless problem. (5)
Is the PSU I received dead? (12)
Print spooler problem (15)
windows vista security holes (11)
radeon x850xt platinum & shader.. (6)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (11)
Recent Discussions
Kingston Bluetooth Dongle Driver (1)
Multiple Restarts Required at Boot (3)
Open With ..... Win7 (1)
webcam (0)
upgrade for hp a6101 (0)
windows vista security holes (11)
Laptop with wireless problem. (5)
Modern Warfare 2: Who Bought It? (64)
tv not turn on-makes clicking sound (2)
CPU fan stops spinning randomly (9)
EVGA 9800 gtx help with finding a goo.. (11)
Regular Build (11)
Help with onclick and buttons (0)
Virus advise (8)
My monitor won't turn on after instal.. (1)
Internet Lost (3)
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
Point and Shoot Camera Suggestions. (4)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)
How to convert MP3's (4)
Wireless Televisions. (12)
Hp Artist Edition + Matching Bag (0)


All times are GMT -4. The time now is 08:41 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28