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 / June 2007

Tip: Looking for answers? Try searching our database.

Set Current Row in SubForm datasheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Todd H - 08 Jun 2007 23:42 GMT
I have a form that has "line item" information, and I have a subform
that displays the "billing periods" and their actual or forecast cost
for each period.  I am trying to set the current row in the subform to
the "billing period" that was 3 months ago, so that I do not have to
scroll down everytime to get to the 'current' billing period (I chose
3 months, so I could still view the last two entries in the
datasheet.  I still want to be able to view all the records, so a
filter is not what I am after.

I am trying to add the code at the OnCurrent property of the Subform,
and can't get DoCmd.GotoRecord or DoCmd.FindRecord to work; I can't
even seem to be able to assemble any code that will work.

Here are the specifics:

Master form: frmEstimateLineItems
SubForm: frmPaymentsSubform; and [BillingPeriodEndDate] is a field in
the Subform I am basing this on.

I need to set te datasheet to have the first row be:

[BillingPeriodEndDate] = Between DateAdd("m",-3,Date()) And
DateAdd("m",-4,Date())

Where each datasheet row is based on [BillingPeriodEndDate]
Todd H - 09 Jun 2007 05:03 GMT
Well here is the code I have gotten, but I can't seem to get the
GoToRecord formatted correctly:

Me!frmPaymentSubform.SetFocus
DoCmd.GoToRecord , acActiveDataObject, acGoTo, BillingPeriodEndDate =
"Between" & DateAdd("m", -3, Date) & "And" & DateAdd("m", -4, Date)

Please help. Thanks,

Todd
Carl Rapson - 11 Jun 2007 16:41 GMT
> Well here is the code I have gotten, but I can't seem to get the
> GoToRecord formatted correctly:
[quoted text clipped - 6 lines]
>
> Todd

You need spaces after 'Between' and around 'And'. Also, you might need to
bracket your dates with "#":

DoCmd.GoToRecord , acActiveDataObject, acGoTo, BillingPeriodEndDate =
"Between #" & DateAdd("m", -3, Date) & "# And #" & DateAdd("m", -4, Date) &
"#"

Carl Rapson
 
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.