Get current record in subform and fill fields of that record to another form

  • Thread starter khanhly246 via AccessMonster.com
  • Start date
K

khanhly246 via AccessMonster.com

Hi all,

I use MS Access 2003 and VBA,
I have a main form and a subform inside, in main form i have many controls
(textbox, combobox, checkbox) to query data in tblCustomers table, when user
input keywords and press 'Query' button, the result of searching is shown in
the subform (subform is clocked),
after that, when users want to edit data in subform, they go to the record
that they want to edit and press the 'Edit' button,another form is opened and
fields of that record is filled in controls (textbox, combobox,...) in new
form and users and edit infomation,then user press 'save' button to save that
record and close that form.

I have an idea: I use bookmark property to get ID of tblCustomers table and
then I create a query and create new form with source is that query i have
just created. but i don't know how to do
What do i have to do in this case? Or can you give me some ideas?
Please help me, ASAP!!!! thank you so much

Best regards !
Khanh Ly
 
G

Guest

just an idea but. why are you creating a totally new form? I would lock the
subform when you first open it. then if your user wants to edit it they can
click an Edit button on that same form and you set the code to unlock the
subform allowing the user to make edits. I would first give them a message
advising them that it is now okay to make changes. Then once they are
complete have a SAVE button that asks the user if they want to save the
changes if yes then save it if not return the record back to its original
state and in either case lock the subform
On your EDIT button
Me.Form.AllowEdits = True
Msgbox "It is now okay to make changes to this document.",vbokay

On your SAVE Button
dim RetValue as string

retvalue=msgbox("did you want to save the changes?"vbyesno)
if vbyes then
me.form.allowedits=false
msgbox "changes have been saved",vbokay

elseif vbno then
me.form. allowedits=false
msgbox "changes have not been saved",vbokay
DoCmd.RunCommand acCmdUndo
end if
 

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