That is awesome, thank you so much. If i could just have your quick help i one more thing that would be superb. Now what would the syntax be for an update query, that after this query runs would then delete the 5th and 10th characters which would be the hyphens?????
hi troncarver
i buid a form with a button with this code and it works
Private Sub Command0_Click()
Dim rs As Recordset
Dim db As Database
Dim strnewstring As String
Dim strfind As String
Dim strreplace As String
Dim teste As String
Set db = CurrentDb
strfind = "-"
strreplace = ""
DoCmd.SetWarnings False
Set rs = New ADODB.Recordset
rs.Open "select ndc from drug;", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If Not rs.EOF Then
Do Until rs.EOF
strnewstring = Replace(rs("ndc"), strfind, strreplace)
' Debug.Print strnewstring
DoCmd.RunSQL " update drug set ndc='" & strnewstring & "' where ndc like '" & rs("ndc") & "';"
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
be carefull because you have a blank field on ndc column,line 984
ndc Name QOH Actual
BRUSH TEETH 815 ,
if you could have this, put a where clause in the openrecordset query
checoturco