Solved

Update a form, based on a selection from another form

Posted on 2011-09-09
7
273 Views
Last Modified: 2012-05-12
I have setup two networked PCs with MSAccess 2003.
I want the first pc to put entries into a table using a form, then what ever entry is currently selected on the 1st PC's form called form1, I want the 2nd pc to display that record on the 2nd PCs form2.
to amplify.
I have a table with only 4 entries.
On form 1 on pc 1 i have selected entry 3.
I want pc 2 using form2 to display the entry 3.
Then if i change the entry on PC1 form1 to entry 2
I want pc 2 to reflect entry 2
Can u advise?
0
Comment
Question by:jwjjwj
  • 4
  • 3
7 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36514856
I hope you are good at VBA...
Note that while this works, things like this (running commands across databases) is *extremely* risky and unpredictable.
You will also have to customize this code to work just the way you need it to.

But again, it works OK in both PC are *Tightly controlled*, otherwise all sorts of odd things can start happening...
(You should have iron-clad error handling on all subs and perhaps implement "RollBack" code)
This is why I stated that you should be well versed in VBA before attempting this...


In any event...
Put this in the code for the Form in the 1st PC:

Private acc As Access.Application

Private Sub Form_Open(Cancel As Integer)
Set acc = New Access.Application
    acc.OpenCurrentDatabase "c:\YourFolder\TargetDB.mdb"
    acc.Visible = True
    acc.DoCmd.OpenForm "frmCustomers"
End Sub

Private Sub Form_Current()
Dim strCustID As String
strCustID = Me.CustomerID
    acc.DoCmd.OpenForm "frmCustomers", , , "CustomerID=" & "'" & Me.CustomerID & "'"
End Sub


Private Sub Form_Close()
    acc.CloseCurrentDatabase
    Set acc = Nothing
End Sub



Make sure the second db has the exact same form name and table available.

;-)

JeffCoachman
0
 

Author Comment

by:jwjjwj
ID: 36516035
Hi Jeff, thanks for that, however I have not explained myself clearly enough.
There is only one db, with one table and two forms. one and entry form on the 1st pc and the other a display form on a 2nd pc, both from the same db.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36516468
Is the one DB "Split"?
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:jwjjwj
ID: 36517876
No, the db is not split. it is just a stock standard database, networked between two pc's.
One pc has and update form, the other a display of the latest data which has been seletect on the update form
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 36526635
Try this

(It is not clear how you are handling the opening and closing of these forms, but this should work...)

Have two forms with the same recordsource.
On Form1 (The"Control" form) put code like this on the current event:

Forms![Form2].Filter = "ID=" & me.ID
Forms![Form2].FilterOn = True

I am sure you can easily modify this to work in your database.
0
 

Author Closing Comment

by:jwjjwj
ID: 36527402
Thank u - works like a dream.
May require further help as I now have to kick off a list that I want to display, but if so, I will ask another question.
Regards
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36529623
;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now