By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,863 Members | 853 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,863 IT Pros & Developers. It's quick & easy.

Form that pulls from two seperate tables to compare data?

P: 1
I have a database which consists of tblMaster, tblMasterReplica, frmMaster (to display info from tblMaster), frmChange (to make changes to data, which are saved to tblMasterReplica). I also have a tblAudit (tracks changes made to the tblMasterReplica).

I need to create a form to display the data from only one entry from both the tblMaster & tblMasterReplica (two rows of data--only record that changed and original data). I want it to be two columns (ex. "Old Data & Updated Data") in between the two rows I want an approve and a deny button. If approve is clicked, the updated data will override the old data in the tblMaster, if the deny button is selected I want the information to revert back to what it was in the tblMasterReplica.

My knowledge of access is limited as this is the first database I have attempted to create so all of your help/advice is very much appreciated!

Thank You.
Jul 30 '12 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 3,205

Keeping your vision in mind, I would begin by creating a master form called frmMaster, based on tblMaster, with all the controls (text boxes, etc.) on the left hand side of the form. I would keep the right hand side of the form blank.

Next, create another form, nearly identical to that first form (if the field names of the two tables are identical, you could copy that form) and save as fsubReplica. Its record source should be tblMasterReplica. Move the controls on fsubReplica over to the right a bit and add command buttons to the left of each of your controls.

Insert fsubReplica into frmMaster as a subform and link the two forms Master/Child fields based on the Primary Key of tblMaster. Simply align the text fields so they correspond to each other (you'll have to see this in form view, rather than design view.

The code behind your command buttons would be quite simple:

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Option Compare Database
  4. Private Sub cmdAcceptChange1_Click()
  5. On Error GoTo EH
  6.     Me.Parent.txtField1 = Me.txtField1
  7.     Exit Sub
  8. EH:
  9.     MsgBox Err.Number & " " & Err.Description, vbCritical, "Error!"
  10.     Exit Sub
  11. End Sub
You would have simlilar code for each command button for each text field. I'm not sure you really need a deny button, because your tblMaster should be unaffected by any denials. Users should only be allowed to change tblMasterReplica. However, the deny button to change tblMasterReplica back to the original would have very similar code.

Hope this gets you started....
Jul 30 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.