My Assistant
![]() ![]() |
|
|
Feb 25 2007, 03:31 PM
Post
#1
|
|
|
UtterAccess Veteran Posts: 394 From: Colorado |
I was using a number field, and I changed the field to a Text field
The Field is RoNumber I was using this code to check for duplicates and give me an option box to change it or leave it as a duplicate value CODE If DCount("*", "DiagnosticTable", "RONumber = " & Me.RoNumber) > 0 Then If MsgBox(Me.RoNumber & " already exists!" & vbCrLf & _ "Do you want to go back and correct the RO Number?", vbYesNo + vbQuestion, _ "Duplicate Value") = vbYes Then Me.CustomerName.SetFocus Me.RoNumber.SetFocus Exit Sub Else End If End If this code must be treating it as a numeric value, can it be changed to a text? My guess isto add quotes to the & "'"Me.RoNumber"'" but I am not real clear about how or what the difference is. (I am attempting to "Overhaul" my Database), I have several errors that I am attempting to overcome. David |
|
|
|
Feb 25 2007, 03:57 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 4,622 From: North Carolina, USA |
You're close!
Change first line: If DCount("*", "DiagnosticTable", "RONumber = '" & Me.RoNumber & "'") > 0 Then When comparing a text value to a text field, surround the text value with apostrophes. |
|
|
|
Feb 25 2007, 04:10 PM
Post
#3
|
|
|
UtterAccess Veteran Posts: 394 From: Colorado |
Yes that did it.
thank you David |
|
|
|
Feb 25 2007, 04:22 PM
Post
#4
|
|
|
UtterAccess VIP Posts: 4,622 From: North Carolina, USA |
You're welcome! Good luck with your project.
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 24th May 2013 - 05:16 PM |