Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2007, 11:18 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Mdb

 
Old April 13th, 2007, 12:47 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Stange...
Bit clueless as to why the Build would be greyed out...

Is it definately not clickable?

Rob

 
Old April 13th, 2007, 01:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Warning: Be very careful using the BETWEEN syntax.

Unless you are absolutely certain that the datatime field contains only the date portion of the datetime (without hours, minutes or seconds), you would be much safer using:
Code:
BETWEEN #01/01/2007# AND #12/31/2007 23:59:59.998#
The syntax you used earlier could lose all the data for the ending date (except for the first instant - 00:00:00.000), if any hours, minutes or seconds are present. The .998 rounds down to the last instant of the date, while .999 often rounds up to the first instant of the next day.

The same caveat applies to
Code:
< #12/31/2007#
or
Code:
<= #12/31/2007#
Rand
 
Old April 16th, 2007, 04:03 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

yup i am not too much sure but i tried to click on every part of screen but cant find hightlighted Event


 
Old April 16th, 2007, 04:43 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Event!?!

"Build" is not an event, are you using the Access Query Designer to build a query to retrieve the data or are you using a ADO/DAO Recordset in VBA?

Rob

 
Old April 17th, 2007, 10:37 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Sorry mistake cant find build highlighted

make it more clear i have graph on form and graph raw source is this query

SELECT (Year([OrderDate])),Sum([TotalValue]) AS [SumOfTotalValue] FROM [Orders] GROUP BY (Year([OrderDate])

I did add combobox so if any one can pick year and graph will display sales for that year

Now i am trying to right click on combobox for build but build is not highlighted


 
Old April 18th, 2007, 03:31 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Ayaz,

While in Form Design Mode, Press "Control" and "G" or press "View" -> "Code".
This will take you to the VBA code window, then select the Combobox Name from the Left drop down list in the middle of the screen, then choose AfterUpdate event in the right.

In the ComboWhatever_AfterUpdate Sub enter the following code:
Code:
GraphName.Requery
(Obviously replace "GraphName" with the name of the graph on your form.
This will requery the graph every time the combo box is changed.

Regards,
Rob

 
Old April 23rd, 2007, 04:14 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

You are superstar mate
Thanks for such generous help
Regards

 
Old April 23rd, 2007, 04:27 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

I take it you got it all worked out?

Always happy to help.

Regards,
Rob


 
Old April 23rd, 2007, 06:28 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Hi Rob

I've done this bit but graph doesnt seem updating
but there isnt any error

Private Sub cmbyear_AfterUpdate()

SelectedYear = "01/" + "01/" + (cmbyear.Value)
PreviousYear = "01/" + "01/" + CStr(CInt(cmbyear.Value) - 1)

graphSales.RowSourceType = Query

graphSales.RowSource = "SELECT [SDate],Sum([TotalValue]) AS [SumOfTotalValue] FROM [Orders] where Order.OrderDate Between #" & SelectedYear & "# and #" & PreviousYear & "# Group by(Year([SDate]) * 12 + Month([SDate]) - 1), [SDate])"
graphSales.Requery

End Sub


regards

Ayaz






Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access Form Bind With OO4O MTForm Access VBA 4 February 27th, 2008 04:29 PM
ms access form as criteria on sql server backend ottos13 Access 1 September 13th, 2006 12:14 PM
problem using ADO to open form in MS Access apike VBScript 3 May 2nd, 2006 06:25 AM
Microsoft Web Browser used in MS Access Form jeff1804 Access 8 December 9th, 2005 07:17 PM
instantiate a form object by its name in MS Access sky2000 Access VBA 1 May 6th, 2004 03:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.