PC Review


Reply
Thread Tools Rate Thread

Dcount problem when using text characters?

 
 
=?Utf-8?B?bWlkaW1hbjY5?=
Guest
Posts: n/a
 
      21st Jun 2006
I have a problem with

If DCount("*", "tblnewparts", "partno = '" & partno & "'") = 0 Then
If MsgBox("This is a New Part - Do You Wish To Add?", vbYesNo, "Project
Costing Database") = vbNo Then
Cancel = True
Me.Undo
Exit Sub

Else: DoCmd.RunSQL "INSERT INTO tblnewparts ( partno, xfile, issue ) " _
& "Values ('" & partno & "', '" & Forms!frmprojectstabbed.Form!xfile
& "', '" & Forms!frmprojectstabbed.Form!issue & "')"

Cancel = True
Me.Undo


End If

End If

This works fine for part numbers such as 20025 but When using part number
that contain characters such as / and - eg 35006/H or 041-03729A the code
recognises these as "new parts" while in fact they are existing parts with
matching records - The partno field is text - Can any one help?

Also when using paste append to import data from excel all part numbers
trigger the new part dialogue - why is this?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?WWFuaWNr?=
Guest
Posts: n/a
 
      21st Jun 2006
Did you try to trim your part number to remove extra space before and after
the part? (Trim(YourPart))

I also know that excel add ' before text cell in some occasion to represent
text. (And it is not visible in excel by default, you have to select the cell
and edit it to see the ' character) It may be your problem.

I have look at your code and it seems correct. You mentioned your part
number field is text so should work. There will be a difference in the SQL if
you need compare both text and number but that is not your case.

Hope it will help.

"midiman69" wrote:

> I have a problem with
>
> If DCount("*", "tblnewparts", "partno = '" & partno & "'") = 0 Then
> If MsgBox("This is a New Part - Do You Wish To Add?", vbYesNo, "Project
> Costing Database") = vbNo Then
> Cancel = True
> Me.Undo
> Exit Sub
>
> Else: DoCmd.RunSQL "INSERT INTO tblnewparts ( partno, xfile, issue ) " _
> & "Values ('" & partno & "', '" & Forms!frmprojectstabbed.Form!xfile
> & "', '" & Forms!frmprojectstabbed.Form!issue & "')"
>
> Cancel = True
> Me.Undo
>
>
> End If
>
> End If
>
> This works fine for part numbers such as 20025 but When using part number
> that contain characters such as / and - eg 35006/H or 041-03729A the code
> recognises these as "new parts" while in fact they are existing parts with
> matching records - The partno field is text - Can any one help?
>
> Also when using paste append to import data from excel all part numbers
> trigger the new part dialogue - why is this?
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Characters in Importing a Text/ CSV File Bob Barnes Microsoft Access 1 6th Jun 2008 04:20 AM
DCOUNT problem with numbers stored as text MJP Microsoft Excel Worksheet Functions 9 4th Jun 2007 05:57 PM
Problem with text field containing special characters/quotes =?Utf-8?B?TGF2dQ==?= Microsoft Access VBA Modules 0 12th Oct 2004 05:29 PM
TextFrame.Characters.Text problem with grouped shape in XP pH7 Microsoft Excel Programming 4 26th Mar 2004 09:26 PM
Re: problem: russian characters in german text Florian Windows XP Internet Explorer 0 27th Jul 2003 10:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 AM.