PDA

View Full Version : SQL EntyID to FirstName


jfxwave
03-15-2006, 10:34 PM
I'm sorry for asking but they don't tech us females about techie stuff but I’m trying my best. I have been working on this one problem for 3 days and I read about half a library.

I'm trying to build a client database that stores their info and all their notes that they make over time (notes are under Time and Date)


My database consist of (Table Clients - entryid, FirstName, LastName, and so on.
And (Table TimeDate – entryid, LastName, FirstName, Time, Date, Notes.

I have the Client side working great but I can’t get the TimeDate working.
When I enter the info it fills in the Client and TimeDate at the same time but if I’m working under a existing client and make a new note it will add a new entry to the TimeDate.

I just need it to populate the box on the left with all the notes that corresponds with that client. The right side populates the clients when opening the program. I can get the entryid of the client :huh


-- get selected item(s)
tSelected = ListBox.GetSelected(this);

-- check that there was something selected
if tSelected then
-- set nSelected to first (only) selected item
nSelected = tSelected[1];

-- Get the entry id of the current item (Data)
nEntryID = ListBox.GetItemData(this, nSelected);

end

But i don't understand how to take the ID of the client and get all there notes in TimeDate to populate the box on the left.
I attached a zip of a database and .am6 as it might help. LOL ;)

Thanks for any help.

TJ_Tigger
03-16-2006, 10:07 AM
One thing I would do is create a relationship between your two tables. That is afterall one of the great things about a database. This can cut down on the number of fields you have. For instance your tables consist of the following:

Clients table contains all the data about the clients.

entryid, LastName, FirstName, Email, PhoneHome, AddressHome, PhoneWork, AddressWork, Notes, Time, Date

The TimeDate table contains the logs you want to record
entryid, LastName, FirstName, Time, Date, Notes

It seems like the entries in red are duplicated between the tables. If this were my application I would build my tables like this:

Clients = entryid, LastName, FirstName, Email, PhoneHome, AddressHome, PhoneWork, AddressWork

TimeDate = entryid, Centryid, Time, Date, Notes

The field Centryid would tie to the customers record in the clients table and all the notes that they record would be stored in the TimeDate table.

When ever the client recorded a note, I would enter the entryid from the client table as the Centryid in the TimeDate table along with the Time, Date and the actual note. If you then want to find all the entries by a particular client in the TimeDate table you could query it like this:

SELECT * FROM TimeDate WHERE Centryid = 2

If you wanted to check for any entry that was made today you could query the table like this:

SELECT * FROM TimeDate WHERE Centryid = 2 and Date = '03/15/2006'

I hope some of this helps you with creating the actions.

Can you export your project for us to see(File->Export). The .am6 file does not have any code that would populate the list boxes.

Tigg

jfxwave
03-18-2006, 08:25 PM
Thanks again but that didn't work but made me think of another way.
:p :yes

TJ_Tigger
03-19-2006, 08:50 AM
Good, i am glad you got something working.