Value to different form.

Clayhead22

Registered User.
Local time
Today, 14:25
Joined
Feb 22, 2015
Messages
36
Hi All

Im struggling with something that should be quite simple.

I have a form named "Task" which can have actions added to it by clicking new it opens the "Add Action" form.

Both forms have a field called "Task Id"

What i want to do is when you click new action and it opens to form as new record. I want the task id to update to be the same as the Task ID from the task page i just clicked the button on.

I have tried the below and the task id just stays as 0.

Onload.
Me.Task_ID.Value = [Forms]![Task]![Task ID]
 
>>> Both forms have a field called "Task Id" <<<

Is this a field in one single Table?
 
Nope have 2 tables. 1) Tasks 2) Task actions. Reason i need to do it is so the task action gets the Tasks Auto ID assigned to it so the query i run will pull back all actions that relate to that task
 
Onload.
DoCmd.GotoRecord, , acNewRec
Me.Task_ID.Value = [Forms]![Task]![Task ID]
 
Value remains as 0. I have the new record sorted via macro but just cant get the task ID to update
 
Just seen that it remains on the new record now with value of 0 but adds another record in the table with a value of 1 in task id but the rest of it is blank
 
remove my code that add new record.
you can use Tempvars variable on your first form to save the ID:
on the current event of your first form:

private sub form_current()
TempVars("TASK_ID") = Me![Task ID]
end sub

now on load event of your second form:

private sub form_load()
me![Task ID] = TempVars("TASK_ID")
end if
 
Could you post a copy of your DB with any private personal information removed. If you have trouble posting it because of the forum rules, then please send it to me at MailTonyHine@gmail.com
 
Last edited:

Users who are viewing this thread

Back
Top Bottom