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 Programming / April 2006

Tip: Looking for answers? Try searching our database.

Open form problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony Williams - 07 Apr 2006 14:35 GMT
I have a command button on a form based on a table tblmonth, which when
clicked opens a form to show all data from one table, tblmain, where the
date input by the user, txtmontha, is the date which is in a field
txtmonthlabela, in the table tblmain. BUT I also only want the form to show
companies where the Euro indicator against the company in a compnay table,
tblcompany is set to yes. Here is my code
Private Sub Command2_Click()
On Error GoTo Command2_Click_Err

   DoCmd.OpenForm "frmFDA", acNormal, "",
"[txtMonthlabela]=[Forms]![frmsterlingeurocos]![txtmontha] And
[tblCompany]![txtEuroIndicator]=Yes", acEdit, acNormal

Command2_Click_Exit:
   Exit Sub

Command2_Click_Err:
   MsgBox Error$
   Resume Command2_Click_Exit

End Sub
The first part works in that only records for the relevant month but all the
compnaies are shown not just those where the euro indicator is set.

What am I doing wrong?
Thanks
Tony
Barry Gilbert - 07 Apr 2006 14:52 GMT
You can't directly refer to tblCompany this way. At this point in you
code, it has no relation to the form. This looks like it needs some
kind of join, which will be difficut from the WhereCondition clause.

Is there any reason not to change frmFDA to filter for the company in
its underlying query?

Barry
Tony Williams - 07 Apr 2006 15:00 GMT
You mean base my form on a query rather than the table? Yes I'll have a look
at that why didn't I think of that :-)
Thanks
Tony
> You can't directly refer to tblCompany this way. At this point in you
> code, it has no relation to the form. This looks like it needs some
[quoted text clipped - 4 lines]
>
> Barry
 
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.