Viewing data that belongs to logged in users only

I have read all discussions about how to go about this but to no avail.

  1. I have created a security module for users and this has created 2 tables in my database, namely:
    sec_customerslogged
    sec_customersusers

  2. I have 1 table called “inbound cargo alert” that has the following fields:
    ownerid, tracking_no, parcels, weight, carrier…etc

  3. Previous instructions says that I should add an “owner” field to the table which I already did.

  4. On the Validate event for my form_inbound cargo - I’ve put in {ownerid}=[usr_login]

Did I follow the instructions correctly? Or am I missing anything?

What I want to happen is, when a user is logged in, he has 2 items on the menu - to view tracking numbers he already entered and to enter a new tracking number.

When he enters a new tracking number, it should show up on the grid view of inbound cargo alert.

I will appreciate any help anyone can offer. Thank you.

No. At Form-/Grid-Settings / SQL expand your SQL with … WHERE ownerid = [usr_login]. That display only records with that ownerid.

In your Form Settings / Edit Fields set simple the “DB value (insert)” to [usr_login]. SC then sets fully automatic the ownerid for you ;).

Thank you so much Reinhard for your prompt reply.

I followed your instructions, however I am getting an error: I’ve already checked my database for any column named ‘admin’, but there is none.
Error while accessing the database:
Unknown column ‘admin’ in ‘where clause’

View SQL

[QUOTE=RHS;21423]No. At Form-/Grid-Settings / SQL expand your SQL with … WHERE ownerid = [usr_login]. That display only records with that ownerid.

In your Form Settings / Edit Fields set simple the “DB value (insert)” to [usr_login]. SC then sets fully automatic the ownerid for you ;).[/QUOTE]

Show your sql string …

(mysqlt): SELECT count() from inbound_cargo where ownerid = admin
1054: Unknown column ‘admin’ in ‘where clause’
ADOConnection._Execute(SELECT count(
) from inbound_cargo where ownerid = admin , false) % line 1085, file: adodb.inc.php
ADOConnection.Execute(SELECT count(*) from inbound_cargo where ownerid = admin ) % line 3644, file: form_inbound_cargo_apl.php
form_inbound_cargo_apl.nm_acessa_banco() % line 1068, file: form_inbound_cargo_apl.php
form_inbound_cargo_apl.controle() % line 1558, file: index.php

Error
Error while accessing the database:
Unknown column ‘admin’ in ‘where clause’

View SQL

Script: C:Program Files (x86)NetMake71wwwrootscriptcaseappairlagos1orm_inbound_cargoorm_inbound_cargo_apl.php (3647)

… WHERE ownerid = ‘[usr_login]’.

That worked. I just had to append the single quotes.
Thank you so much for your help.