Value to different form. (1 Viewer)

Clayhead22

Registered User.
Local time
Today, 07:00
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]
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 07:00
Joined
Jul 9, 2003
Messages
16,282
>>> Both forms have a field called "Task Id" <<<

Is this a field in one single Table?
 

Clayhead22

Registered User.
Local time
Today, 07:00
Joined
Feb 22, 2015
Messages
36
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:00
Joined
May 7, 2009
Messages
19,247
Onload.
DoCmd.GotoRecord, , acNewRec
Me.Task_ID.Value = [Forms]![Task]![Task ID]
 

Clayhead22

Registered User.
Local time
Today, 07:00
Joined
Feb 22, 2015
Messages
36
Value remains as 0. I have the new record sorted via macro but just cant get the task ID to update
 

Clayhead22

Registered User.
Local time
Today, 07:00
Joined
Feb 22, 2015
Messages
36
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:00
Joined
May 7, 2009
Messages
19,247
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
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 07:00
Joined
Jul 9, 2003
Messages
16,282
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

Top Bottom