Get control name

jayke

Registered User.
Local time
Today, 05:28
Joined
Nov 19, 2003
Messages
29
Hi,

I am creating an appication in which someone can make tenders. Each tender can be saved and edited.

On my form I have put 15 textBoxes and listboxes. Each control represents a line. The customer can fill in or choose a product or service on each line.

Here is my case:
A customer creates a tender with 10 lines. Later the customer wants to edit his tender but instead of adding new product beneeth the 10 lines he want to add it in between. Lets say in between line number 5 and 6.
How can I create such flexibility?

(See screenshot)

I was hoping that I could create something like this:
The customer puts his cursor on line 5 and pushes the "Add Line" button In the code I will make sure all producs beneeth line 5 will be put one line lower.
But in order to do this I shoud be able to determine on which line or Textbox name the cursor is present (focused)..


Is this possible??

Please help me!!!! :eek:
 

Attachments

  • offerte.png
    offerte.png
    44 KB · Views: 111
Last edited:
The concept of a relational database is that is unordered. The dbs manager (ie the computer program) retrieves a set of data that matches certain criteria and the user (programmer) imposes any order he requires on them.

So normally a new item is added at the end, and the dataset resorted to the usual sort order. If you want an arbitrary order, then you probably need to store a sort key in the underlying data, BUT if you have items in sort positions 1 thru to 10, and want to insert a new number 5 say, then you have to renumber the existing numbers 5 to 10.

Because this does not fit in very well the concept of a general set of data, Access is not good at this sort of thing. You can achieve it, but it is awkward and will need a lot of coding, probably. I know its probably not what you wanted to hear.

Anyone else got any other views?
 
I guess your right!
I already save a line number with each product when I save the tender. But still... it is a hell of a job.

But do you know how I can get the name of a control in which my cursor is set?
If this is possible I will go for that "Hell".. :rolleyes:

Cheers
 
jayke said:
But do you know how I can get the name of a control in which my cursor is set?

Screen.ActiveControl.Name
 
Jayke,

Gemma is right. Each line item on your form should be a different row
in the table. Normally, you'd sort detail lines by product number,
transaction date, or whatever.

If you really need the user to specify some order that visually appeals to
them, that's easily achievable.

In the simplest sense, just add a floating point field to hold the sort
order. The form will sort on this number and the user can position
records anywhere they want. As long as they know that 8.65 is the
entry between 9.6 and 8.7 they'd be fine.

The method works fine, but might be a little tough for the users.

To extend it a bit, it's possible for the user to "click" the records
into their proper order, without even seeing the new sort number.

The attached DB is just a little attempt to rearrange a recordset based
on the arbitrary wishes of the user.

It really isn't that much coding if the users really need to rearrange
things.

Also, just because the records are ordered using floating point numbers,
they can easily be displayed as 1,2,3 ... for reports/forms.

Anyway, just some thoughts, I don't have any apps with this requirement
but it was an interesting question.

hth,
Wayne
 

Attachments

Thank you FLM!
This one is cool! I noticed it doesn't work wile debugging but ...
A very nice one to have!!!

AND

Thank you WayneRyan!
You made a very nice example! This I can defenitly use!

Cheers
Jayke
 

Users who are viewing this thread

Back
Top Bottom