How to make the NEW button work correct

Hi all,

I have a grid with users. From here I show in another grid several reports from one single user based on user_id and report_id. In the header of this report grid is a NEW button where I can add new reports to the customer.

How can I do that the new empty report form relays to that user_id that was shown in the grid before. I tried everything with parameters/variables but it’s not working. The user_id in the new form is always zero.

Joe

hi

you don’t need variable nor parameters

make your user_id auto increment and make sure the insert button is available in your form where you add the new user

once you go to that form from a button, it will open for you a new record to add a new user

[QUOTE=MikeDE;33054]hi

you don’t need variable nor parameters

make your user_id auto increment and make sure the insert button is available in your form where you add the new user

once you go to that form from a button, it will open for you a new record to add a new user[/QUOTE]

Yes it opens to add a new record but I don’t want to add a new user. I like to add a new report TO the user_id. My form always opens with user_id 0 and not the shown user_id in the grid where I come from.

Joe

ok in this case you have to direct your link to a form that creates “new report” and pass the user_id as parameter… basically if the “report form” has user_id as global_variable = In, then you can -while creating the link- assign this ID as your current id before the link (the from point)

one more thing, do you link from onRecord event? because in grid, each line may have different user ID then you need to create a link field (custom field) and link it to your other form passing the id as parameter

or I didn’t get your point dude, so try to add screenshots or explain it in different way

In my grid (from where I link to the form) I have the two values user_id and drill_id but I don’t know how the settings should be.

Where are the settings in the destination form where it can get these values?

Joe

Unbenannt.JPG

destination form will have the variables user_id and drill_id waiting for a value, thats why they appear here when you are targeting that application while trying to create the link

if you have the user_id as a field, your screenshot is ok

now open your target application, alone, it is supposed will ask you for user_id, add one manually, see if you are getting the required results… if yes, then pass that value as parameter from your grid, it will work… if the target form will not give you a required result by adding the variable manually, then work on that first… perhaps you need to have “update” button in target application

If I open the target form it asks me for the user id. If I fill in a user id with existing reports the form shows me the first report in the form. Thats ok.
If I put in a user id without any existing report it still shows me an empty report with no user id. When I save this report it has user_id 0

I tried this several times before.
What should the primary key settings in the sql section of the form? I tried it with user_id, with drill_id and both together - nothing works.

Joe

okay, if the target application will not work as supposed with a user_id inserted manually, then you have to fix that first. Primary key is the auto_increment usually may i suggest to export your project with the sql dump may on of us import it and reproduce your project to understand what is going on

Thank you Mike for your great help :slight_smile:

Joe