INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

help.. I need messae when I enter same data

help.. I need messae when I enter same data

(OP)
Hello My Friends.. I had table contain tow fields ... code and name
when I apend same data to the table , the form show me message told me (the same data in the table... ghange it)..
thanks for all

RE: help.. I need messae when I enter same data

There are a number of ways to do what you need.

My personal choice would be to check for the existence of a matching record BEFORE appending the new record into the table.
Then if a matching record was found, you could display a message in a number of ways.
1) Use a WAIT WINDOW <message>
2) Write a text message to a textbox object on the form
3) Throw up a Messagebox() with your message in it.

Your question is pretty general. What specifically do you need help with?

Good Luck,
JRB-Bldr

RE: help.. I need messae when I enter same data

(OP)
thank for your answer ,,
can you Explain me Practically

RE: help.. I need messae when I enter same data

As I asked before - What part of it don't you understand?

* How to check for Duplicate record?
* How to display WAIT WINDOW <message>?
Look in your VFP Help for: HELP WAIT
* How to display Messagebox()?
Look in your VFP Help for: HELP Messagebox()
* How to write message into form textbox?
* How to avoid Appending new record?

Specifically what part do you need help with?

NOTE: We generally don't write fully operational Code for someone else.
That's your 'learning opportunity'.
But we give advice/suggestions to help you with your very specific issues/challenges.

Good Luck,
JRB-Bldr

RE: help.. I need messae when I enter same data

pcwaleed,
It sounds like you have an index on the table that is preventing duplicate values in the key field. You said your table has "code" and "name" fields. (Are they the only two fields?)
Most likely "code" needs to be "unique". There are some circumstances where this can be a problem. What might be the case is that you have a "code" field that is blank (or 0). And when you create a new record, it initially populates that value at creation as blank or 0, then you have don't have a unique key, and it fails.
Have a look in your table for a blank or 0 value in the code.

It could also be a "compound index", where they are combining the values code and name together. While that's unnecessary for uniqueness, it is a mistake some developers make. So check for that as well in your table.

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: help.. I need messae when I enter same data

(OP)
hello
yes I need check for Duplicate record , if one is Different the operation is Right

RE: help.. I need messae when I enter same data

So did that solve it for you? You're not really clear in your reply.

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: help.. I need messae when I enter same data

Quote:

So did that solve it for you?

We have no idea if you still need help or not.

You have not confirmed if your data table has an Index on it or not.

If not create one....

CODE -->

USE MyData IN 0 EXCLUSIVE
SELECT MyData
INDEX ON  code + name TAG Indx
USE 

Then from your User Data Entry Form in the Valid method of your Save button...

CODE -->

cCode = ThisForm.txtCode.text
cName = ThisForm.txtName.text

SELECT MyData
SET ORDER TO Indx
IF SEEK(cCode + cName)
   * --- Duplicate Found ---
   < Display message to user somehow >
ELSE
   APPEND BLANK
   REPLACE Code WITH cCode,;
     Name WITH cName
ENDIF 

If that still doesn't help, then you should probably spend some time with the Free, On-line VFP Tutorial Videos at:
Free VFP Tutorial Videos

Good Luck,
JRB-Bldr

RE: help.. I need messae when I enter same data

(OP)
thats i want exactly
but show me this message


the error in the replace


code_name and code_cut is name the fields in my table (cutinfo)

my code is
cCode = ThisForm.text1.Value
cName = ThisForm.text2.Value

SELECT cutinfo
SET ORDER TO INDX && CODE_NAME+CODE_CUT
IF SEEK(cCode + cName)
* --- Duplicate Found ---
MESSAGEBOX("jbhhkhkjhj",4,"jhgh")
ELSE
APPEND BLANK
REPLACE CODE_NAME WITH cCode,;
CODE_CUT WITH cName
ENDIF

RE: help.. I need messae when I enter same data

What is not to know?

The error message indicates: Data Type Mismatch

That is self-explanatory.
We don't know the data table field Types that you have for Code_Name and Code_Cut.
And we don't know what the values are which populate the variables: cCode and cName.

However it is obvious that one of the variable values is not matching the Field Type of its intended data field.

As I previously recommended -- Go over to the Free, Online VFP Tutorial videos at: Free VFP Tutorial Videos
and spend some time learning how to use Visual Foxpro.

Among those videos you might want to focus spending time looking at:
Building a Simple Application - Pt. 2

In this video we complete the User (staff) managment forms. One highlight of this video is the use of the Visual FoxPro Debugger.

Good Luck,
JRB-Bldr

RE: help.. I need messae when I enter same data

(OP)
hello
i solved this error
i rename the text properties in the form from character to numeric and every think is right
thank 4 all

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close