Solved

Update a form, based on a selection from another form

Posted on 2011-09-09
7
276 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

728 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