Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / April 2008

Tip: Looking for answers? Try searching our database.

change record source

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ira - 11 Apr 2008 18:22 GMT
I have two forms ADD & VIEW. Each of them have button that will open another
form SERVICE. How can I make to change record source of SERVICE depending on
if it opens from ADD or VIEW?
fredg - 11 Apr 2008 18:52 GMT
> I have two forms ADD & VIEW. Each of them have button that will open another
> form SERVICE. How can I make to change record source of SERVICE depending on
> if it opens from ADD or VIEW?

Without my questioning 'WHY', here is How:

Code the Open event of the form "Service":
If Not IsNull(Me.OpenArgs) Then
    If Me.OpenArgs = "Add" then
        Me.Recordsource = "ABCD"
    Else
        Me.Recordsource = "XYZ"
    End IF
End If

Next code the click event of the button you are using to open this
form:
DoCmd.OpenForm "Service", , , , , , Me.Name
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Klatuu - 11 Apr 2008 19:48 GMT
fredg must have more self control than I.
I really must ask why?
It is a very unusual thing to do.  It seems you would be using the same
recordsource for both view and add.

IMHO, having two forms, one for view and and one for add is extra work
building it and even more work if you have to maintain it.  I use only one
form and use the OpenForm method's arguments to determine how the form will
be used.
Signature

Dave Hargis, Microsoft Access MVP

> I have two forms ADD & VIEW. Each of them have button that will open another
> form SERVICE. How can I make to change record source of SERVICE depending on
> if it opens from ADD or VIEW?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.