Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grid table 3

Status
Not open for further replies.

icecr3amc4k3

Programmer
Apr 25, 2023
7
ID
is the code that I wrote have a many mistakes ?
especially for entering datetime into the gridtable
Screenshot_66_w6hmfe.png

Screenshot_67_ezkh34.png
Screenshot_68_s4xpys.png
 
We are not mind readers! Try to see it from our side. I can't speak for anyone else, but personally I have absolutely no idea of what you are asking. None!

Maybe if you try to explain exactly what you want to achieve, we can help you.

And last, please use a better description for your question! Grid table is a meaningless description when others want to search for help if they have a similar problem.
 
Please read - and take notice - of my post in thread184-1821531 concerning your posting of screen shots.

Frankly, you are asking much too much of us if you expect us to try to read or understand the code in the three screen shots that you posted above, especially as you have provided no context and no information about the errors you are seeing (if in fact you are seeing errors; that's not clear either).

I'm afraid you won't get any useful help in this forum unless you can explain your problem in a simple logical way and in plain English. Simply dumping screen shots in a forum post is just lazy.

Please also take note of what Tore said (above) and what I said (in an earlier thread) about choosing sensible subject titles for your threads.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
To me it's obvious you want to learn or you must learn VFP. It's totally fair that you have many questions, but please, really, post your code in text form, stop just posting screenshots, that's not at all helpful.

You could get going yourself if you take error messages as a chance to learn and look up whatever you don't understand. I know for a beginner the messages can be very cryptic, but if you don't know a term, search for it in the help, to at least get a better understanding of the error message.

There are also videos that teach you the basics of many things in VFP: I suggest you go through all of them, as they will answer a lot of your questions by giving you the foundations to even talk about your problems.

Chriss
 
merpati89

I agree with everyone who replied to you.
I suspect that you find it difficult to write in English exactly what your problem is because it is not your mother tongue.
btw - i have that too.

But imagine if everyone here asked their question in such a way that it reads "I have a question", or "Grid" or some other useless title.
Then the forum would be worthless because you can't find anything.

3 recommendations:

sNo. 1
Begin each query title with "How to....", and then describe the exact problem.
You don't go to a doctor with the comment: "I'm sick", but you tell him WHERE and WHAT; SINCE WHEN and if the problem only occurred ONCE - etc.

No. 2
Use the GOOGLE translator for the description


For example, this complete text was translated from German into English.
The program translates from about 120 languages into English and very well. Then we would all understand you better.

No. 3
It would be nice if you would give us an answer - proper communication is not useful with hard copies.

Kind regards
Klaus

Peace worldwide - it starts here...
 
Klaus said:
For example, this complete text was translated from German into English

Impressive. A perfect job!

Steve (U.S.)

Translation: Beeindruckend. Perfekter Beruf!
 
Steve,
with "Job" it is a little bit complicated.

When you say "I did a good job" then in Germany we say :"Ich habe gute Arbeit geleistet" and "Arbeit" means the same as "work" in English.
However -when your job is a good one, then we say "Ich habe einen guten Beruf" and also "Ich habe einen" guten Job" - in English: I have a good job"

Therefore in this case it is better to say: Beeindruckend. Perfekte Arbeit or Perfekter Job.

Interesting: English: I have a good job, but now I've done a bad job.
German: Ich habe einen guten Beruf, aber jetzt habe ich schlechte Arbeit geleistet.

Klaus


Peace worldwide - it starts here...
 
Thank you, Klaus. My mom's 1st language was German. She taught it. Obviously it didn't rub off on me. My total German vocabulary is now 2 words (I think). [ponytails]

As in English, I suspect a single word may have multiple meanings and tenses, etc. Anyone who does crossword puzzles (like myself) surely is aware of that.

Steve
 
I think you want to insert a record into the table. The way I would do it:

Code:
IF EMPTY(thisform.text1.value)
[indent]MessageBox("You must enter value")
thisform.text1.SetFocus()
RETURN[/indent]
ENDIF
IF EMPTY(thisform.text2.value)
[indent]MessageBox("You must enter value")
thisform.text2.SetFocus()
RETURN[/indent]
ENDIF
IF thisform.optiongroup1.value = 1
[indent]lcKendaraan = "MOTOR"[/indent]
ELSE
[indent]lcKendaraan = "MOBIL"[/indent]
ENDIF
lcWarna = ALLTRIM(thisform.text1.value)
lcPlat  = ALLTRIM(thisform.text2.value)
INSERT INTO table1 (kendaraan, warna, plat, wmasuk) VALUES (lcKendaraan, lcWarna, lcPlat, DATETIME())
thisform.grdTable1.Refresh()

As for the controls, I would give better names to them. Using Text1, Text2, grdTable1, and optiongroup1 does not give any meaningful explanation as to what the control is for. I would suggest opgKendarann, txtWarna, txtPlat, and the grid named for the table name that should also have a meaningful name.

Greg
 

That's actually where the problem begins. Some screenshots and the introducing text don't indicate to me, what is the intention of that experiment. To learn about the grid (the thread title indicates that) or about table handling. In the end, the code does the least part with the grid itself.

It will not motivate merpati89 to formulate better questions, if you give answers, I held back what I could say about the errors, as it just tells merpati89 he still gets through. I also think it's better to first have a foundation before you make your own experiments. So I hope merpati89 has taken the hint and does work through Garfield Hudsons videos.

Chriss
 
Chris--

I disagree, his code does indicate what he wants to do -- he adds a record to the table (APPEND BLANK), and then updates the record with the values from the form controls; however, he was getting the error with the attempt to assign the DATETIME() value. I agree he does not ask his question very well and it is better not to use screen shots as he has done; although there are occasions for a screen shot.

I used to do the same type of coding back in the late 80's and early 90's (APPEND BLANK with subsequent multiple REPLACE commands). I later learned to use a single REPLACE command with each field comma separated:

Code:
REPLACE field1 WITH "Value1", ;
        field2 WITH "Value2", ;
        field3 WITH "Value3"

This improved the speed as the record was updated with a single command for all fields. Then later the SQL command was available, and I began using the INSERT command (don't remember the release) which is faster than the APPEND BLANK and REPLACE combination. I hope I gave Admad some things to think about in adding records to tables.

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top