×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

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.

Students Click Here

THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D
2

THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

(OP)
thisform.label15.Caption=thisform.label1.Caption
LOCAL TABELA, PREDMET
PREDMET = thisform.combo1.Value
TABELA = thisform.label1.Caption + "_" + PREDMET
IF NOT USED(TABELA)
create table(TABELA);
(PP N(1), ;
DP N(1))
ENDIF
* Change control source of Textboxes individually for PP
THISFORM.TEXT3.ControlSource = TABELA + ".PP"
THISFORM.TEXT4.ControlSource = TABELA + ".PP"
THISFORM.TEXT5.ControlSource = TABELA + ".PP"
THISFORM.TEXT6.ControlSource = TABELA + ".PP"
THISFORM.TEXT7.ControlSource = TABELA + ".PP"
THISFORM.TEXT8.ControlSource = TABELA + ".PP"
THISFORM.TEXT9.ControlSource = TABELA + ".PP"
THISFORM.TEXT10.ControlSource = TABELA + ".PP"
THISFORM.TEXT11.ControlSource = TABELA + ".PP"
THISFORM.TEXT12.ControlSource = TABELA + ".PP"
THISFORM.TEXT13.ControlSource = TABELA + ".PP"
THISFORM.TEXT14.ControlSource = TABELA + ".PP"
THISFORM.TEXT15.ControlSource = TABELA + ".PP"
THISFORM.TEXT16.ControlSource = TABELA + ".PP"
THISFORM.TEXT17.ControlSource = TABELA + ".PP"
THISFORM.TEXT18.ControlSource = TABELA + ".PP"
THISFORM.TEXT19.ControlSource = TABELA + ".PP"
THISFORM.TEXT20.ControlSource = TABELA + ".PP"


* Change control source of Textboxes individually for DP
THISFORM.TEXT21.ControlSource = TABELA + ".DP"
THISFORM.TEXT22.ControlSource = TABELA + ".DP"
THISFORM.TEXT23.ControlSource = TABELA + ".DP"
THISFORM.TEXT24.ControlSource = TABELA + ".DP"
THISFORM.TEXT25.ControlSource = TABELA + ".DP"
THISFORM.TEXT26.ControlSource = TABELA + ".DP"
THISFORM.TEXT27.ControlSource = ETABELA + ".DP"
THISFORM.TEXT28.ControlSource = TABELA + ".DP"
THISFORM.TEXT29.ControlSource = TABELA + ".DP"
THISFORM.TEXT30.ControlSource = TABELA + ".DP"
THISFORM.TEXT31.ControlSource = TABELA + ".DP"
THISFORM.TEXT32.ControlSource = TABELA + ".DP"
THISFORM.TEXT33.ControlSource = TABELA + ".DP"
THISFORM.TEXT34.ControlSource = TABELA + ".DP"
THISFORM.TEXT35.ControlSource = TABELA + ".DP"
THISFORM.TEXT36.ControlSource = TABELA + ".DP"
THISFORM.TEXT37.ControlSource = TABELA + ".DP"
THISFORM.TEXT38.ControlSource = TABELA + ".DP"

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

I don't know what you want, but I would say this form will show the same record in every textbox. Textboxes are for the current record only, not for multiple records. Use the grid to show a list of records.

Chriss

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

2
I hate to discourage people posting questions here, especially relatively new forum members such as yourself, Filip. But, really ... You are just dumping a load of code into the forum, with no explanation of what it is supposed to do or what you are trying to achieve. And you paste an error message into the thread title, without telling us where the error occurred or under what circumstances. And you expect us to help you on that basis.

I have to point out that you did something very similar in thread184-1828789: ControlSource manipulation via command button!. In that thread, some of us spent some time trying to understand your problem and suggest a solution. But you never gave any feedback on our replies. You didn't even have the courtesy to acknowledge them.

We really want to help, but please don't make it so difficult for us.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

(OP)
Okay i get what you are saying but, im not really used to messages and chatting, my english is not on that level and neither is my visual fox pro knowledge, im trying to change the controlsource via commandbutton click, i know you guys are mentioning grids but i have no clue what that is, is there any way we can hop in a call and i explain with my sharescreen or something? Thanks in advance... And sorry for rude/rushed questions im 17 and i like learning this but im rushing alot thats my habit.

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

I wonder how you can put loads of textboxes on a form but not a grid.

When you design a form in the form designer, the grid is just another control in the form controls toolbox, as a textbox is:

Textbox


Grid


You click on the textbox of the Form Controls toolbar, then on the form to get Text1 on the form.
You click on the grid of the Form Controls toolbar, then on the form to get Grid1 on the form.


How did you even crete a form with tens if not hundreds of textboxes? I already told you in your previous thread you're on a dead end, this won't work, what you need is a grid. So when you don't know what that is, the help is there at F1 and you can search "grid" there or simply ask in the next post or thread, like you now finally did. Just because you're a new forum member we do not know what you know or not at all. And why would we even assume you can't put a grid on a form, when you did already prove you can put a lot of textboxes on a form? It's the same process, just take the grid and not a textbox.

Notice, the grid has no controlsource property, instead its similar property is called RecordSource. You specify just the table name there - and USE that table in the load event code of the form or open it in the data environment of the form, so the grid shows that tables data in multiple columns - as many as are necessary to list all data and multiple columnns, as many as are in the table. You can also predesign how many columns and which to show when you go into the sub elements of the grid object (well, the columns) and define the controlsource on that level, but for a starter just let the grid create its columns and rows automatically.

Notice, you actually learn the most difficult to use control here, some avoid the grid, but as soon as you want to display a list of data from a table you don't have many choices. A Listbox is an alternative control you can also use, it will display rows readonly, though. And it's main intent is not only to list rows, but let the user pick (select) one of them. It does not compare to having many textboxes, therefore you rather want to use the grid. The third and even more less like the grid control to display lists is a combobox, it just shows one cell and you have to use its dropdown button to show a list, possible with multiple columns, so it's like a listbox showing on demand, needs far less space on a form, but is also not very comfortable to see and navigate the list of data.

At the level you are, you won't get forward with "learning by doing" only. You need to learn basics before being able to even do simple things, so perhaps look for some learning materials. I found this mentioned on tek-tips often enough: https://www.garfieldhudson.com/Free-Videos.html

Chriss

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

(OP)
Thanks chris,ill play with this a little and tell you how it goes.

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

Quote (Filip Brnic)

im 17 and i like learning this

Why don't you go for something more modern, when you're just starting to learn programming?

MS offers the community edition of visual studio for free and you can program almost anything with that alone, even the far simpelr vscode is a better entry into the world of todays programming on Windows.

Chriss

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

(OP)
chris, good question. first of all i started doing this because my grandad when he used to be a live, used to be one of the first major programmers in serbia and he developed a accounting program in visual fox pro, as well as pos systems etc etc, and his Agency still goes on and the program keeps getting updated every year by 1 programer he was good friends with, my family gave me a task to just have fun in fox and learn it so when the program encounters a problem i can assist them since all of them are into economy part and only me and 2 people understand fox. also ive been around computers all my life and tried some program languages but fox gives me the creative freedom i like and ofc the visual aspect.

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

Well, then do you have the source code for thse applications? I'm not asking for here, I'm asking for you to learn from the full sources of a grown up project, that's giving you much more to learn from than trying from scratch.

As this was programmed by your granddad, it's likely not Visual Foxpro but legacy. In the older FoxPro versions you didn't have the visual aspect, at least not in the same manner as with VFPs form and class desingers. I don't know if that'll help you maintain such projects or to upgrade these projects into the more modern visual FoxPro. Old projects also had SCXes, but they are not the same as VFP SCXes. They are used to generate a SPR screen program. And that's run. You hada screen designer that VFP lacks. And so to maintain legacy projects you also need a legacy VFP IDE.

And while VFP can still also build an EXE from such a legacy project, maintaining it is nightmarish. Upgrading such a project also would take someone experienced.

If you'd like to learn how Visual Foxpro Forms work, there's also a simple way to get at some small projects that are already provided. You can go to tools -> component gallery:


Pick one of the specific applications, books template is like a library system. Anyway, these are surely showing all concepts needed to have a "full blown" application (well, actually just a small application, but still with many aspects) and you can look into any detail of interest.

Chriss

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

(OP)
Hey chris a bit of misunderstanding, im not working in his program/application. Im not gonna get into it but hehas been developing it for 25 years, and now its an accounting program, Im currently just doing my own things, im thinking about what you can use fox pro, i was making a "caffee" layout with tables and ordering system, im currently making a school gradeing system, etc etc whatever comes to my mind, So no im not working in his application, since its for our clients for doing taxes sales storage tracking etc... To put in perspective he had around 12000 files without images in his first official program, and he had in each of those 100+ codes/methods proeprties etc... He used to be one of the higher paid programers at his time. he used to just play around and learned on his own, so im currently doing just that.

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

Quote (Filip)

im not working in his program/application. Im not gonna get into it

You're kind of contradicting yourself here.

Quote (Fiip)

and learn it so when the program encounters a problem i can assist them

It's clear you're not yet working in this project, you have not enough knowledge. But wouldn't it be a goal to get there? Okay, so I take from this for now you're trying to get into FoxPro on a basis of just getting into the language with no strings attached. And obviously it's good to begin in the latest VFP version.

So, well, that's kind of good news, you then are not bound to learn legacy style programming. VFP9 won't tech you that, if it becomes a later goal, you'd really also need an old version of VFP like the first MS version or even before it became a Microsoft product to learn concepts of that. Many topics about old parts of the FoxPro language only still supported for downward compatibility only tell you to not use these old concepts and use other things instead. So your only chance to learn how old style screens work, how you do user interaction in that style, VFP9 won't enable you to learn that.

On the other side that means you can learn how VFP applications work in Visual FoxPro. That makes it even more practical to look into some of the code and projects you can generate from the templates in the component gallery I pointed out to you. Give it a go.

Chriss

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

(OP)
Gotcha, ill have in mind what you said, thanks for the grid help, i have my form work like i imagined. Although, if i wanna ise alter table to change the current grid, should i change the table with alter table or should i use something like add column? I wanna alow clients to add columns do the grid, by having a texbot where they will input the columns name and then having a command button that makes thisform.grid1.addcolumn=thisform.text1.value? Am i on the right track?

RE: THE DATA SOURCE FOR THIS OBJECT MUST BE A VARIABLE REFERENCE. Help me :D

One thing I saw in your orignal post just now, after all this discussion, is:

CODE -->

THISFORM.TEXT27.ControlSource = ETABELA + ".DP" 

I don't see how that would cause the error you say VFP displays in this thread title, but it doesn't really matter much, as I already told you in your previous post

Quote (myself)

The second thing you get wrong is that youu assume you can feed multiple records of the same table with textboxes. No matter how you position them in rows, a textbox is a control that always would be bound to the current record within the workarea, that is set in the controlsource

If you set tons of textboxes to show tablea.dp, they all show the dp field value of one record, you would see the same value in all of them, do a SKIP 1 and all of them will show the value of the next record. Only controls for lists of records can do what you want with a controlsource/recordsource or rowsource (the same again similar property of the listbox and combobox I also already mentioned are controls for lists of data).

It's really the main concept of Foxpro to have the one currently set active database (dbc, with multiple tables), to have one current datasession (a list of workareas, which hold all used (opened) tables or cursors), to have one current workarea of that (one slot, one alias, one table), and to have one current record within that (aka a recordpopinter within the workarea, which is controlled by GO TOP/GO BOTTOM, SKIP -1/+1 +/-N, GO recno, LOCATE, SEEK, etc. but one at a time only), and the controlsource then is the last stage in that "one" current X of Y concept and binds to one field of that current record of the current workarea in the current datasession of the currently set database. The last level is optional, a table can also be "free". But you see, this concept is very fundamental, current X of Y. And in regard of the recordpoiunter or currrent record, current row, current recordnumber, current ID, however you choose to talk about it, this only changes by code navigating to another record, not by moving a control down or have it repeatedly in the form. That's why it is absolutely unimportant to fix that error, you never get what you intend to get when you set lots of textboxes to the same controlsource.

Chriss

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! Already a Member? Login


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