Update a field when clicking a command button

  • Thread starter Thread starter Rebecca
  • Start date Start date
R

Rebecca

Hello,

I have a subform that has the field AssetID (autonumber).
When I enter a new asset then I click a command button
that opens a form where I can enter details about that
asset. The second form that opens is linked to the first
by the AssetID. If I am entering a new asset I have to
actually move from one record and then back to the one
where I just added the asset in order to get the second
form to open with AssetID field filled in. I would like
to have the table updated when I click the command button,
but cannot find the right code. I can copy small pieces
of code, but I am not really familiar with VBA or SQL. I
tried to use an event procedure on click for the command
button and then said assetid.update, but that didn't
work. Any suggestions?
 
Your posting is somewhat difficult to understand.

Could you explain the table / query structure and relationships behind the
forms first.

Can you describe why you have the second form to enter asset details?

A simple structure to follow and maybe expand on would be:
tblAsset
fields :
AssetId (Autonumber)
assetdetails1
assetdetails2
assetdetails3
assetdetails...

qryAsset based on tblAsset

frmAsset (Form based on qryAsset)
controls :
AssetId (Autonumber)
assetdetails1
assetdetails2
assetdetails3
assetdetails...


Entries in form generate Autonumber
one form per one asset
open form with command button as per your needs
HTH
M
 
Back
Top