Add New record Issue (1 Viewer)

Ossama22

Registered User.
Local time
Today, 16:30
Joined
Aug 31, 2018
Messages
52
Hello Guys ,

I have 2 forms one called Reference , the another one named LCL , Iam just asking about how can i create a button in LCL form to add a new record ( with the data from LCL form ) to the Reference table . is there any code or macro could help me to do that task ?

Thx
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:30
Joined
Aug 30, 2003
Messages
36,118
If all the data is present on the LCL form, you can execute an append query that gets values from there. Otherwise, you can use OpenForm to open the reference form in add mode, and copy relevant data to that form.
 

Ranman256

Well-known member
Local time
Today, 10:30
Joined
Apr 9, 2015
Messages
4,339
append query. To add items in 1 form/table to the target table.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:30
Joined
May 7, 2009
Messages
19,169
same as above:

create a query.
when the Show Table pop up, close without selecting any table.
on the ribbon, select Append.
choose Reference table.
on the row Field:, add [Forms]![LCL]![textbox1]
on the row Append To: type the field from Reference

do this with the rest of the field to insert.
sace the query.

now go back to your LCL Form in design view.
add code to the Click event of the button:

private sub button_click()
docmd.setwarnings false
docmd.openquery "the name of new query you made"
docmd.setwarnings true
end sub
 

Ossama22

Registered User.
Local time
Today, 16:30
Joined
Aug 31, 2018
Messages
52
same as above:

create a query.
when the Show Table pop up, close without selecting any table.
on the ribbon, select Append.
choose Reference table.
on the row Field:, add [Forms]![LCL]![textbox1]
on the row Append To: type the field from Reference

do this with the rest of the field to insert.
sace the query.

now go back to your LCL Form in design view.
add code to the Click event of the button:

private sub button_click()
docmd.setwarnings false
docmd.openquery "the name of new query you made"
docmd.setwarnings true
end sub


Thx Bro , u saved my life :) i did it and it's worked , thx again
 

Users who are viewing this thread

Top Bottom