Update a field when clicking a command button

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?
 
M

Martin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top