473,943 Members | 29,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Opening Queries in Access 2007

kmartinenko
12 New Member
Hello all,

My system was recently "upgraded" to MS Office 2007 and now I am having a really frustrating time trying to get my simple command button to open a query.

This is the same database I posted a couple of questions about back in January. The VBA code for the two combo boxes and the subsequent command button is as follows:

Expand|Select|Wrap|Line Numbers
  1.  Private Sub route_combo_AfterUpdate()
  2. Me.timepoint_combo.Requery
  3. End Sub
  4.  
  5. Private Sub Search_Click()
  6. DoCmd.OpenQuery , "Query1", acViewNormal
  7.  
  8. End Sub
  9.  
  10. Private Sub timepoint_combo_AfterUpdate()
  11. CurrentDb.QueryDefs("Query1").SQL = "SELECT * FROM [RideData] WHERE ((([RideData].[ROUTE])=[Forms]![Form1]![route_combo]))AND((([RideData].[TRIP])=[Forms]![Form1]![timepoint_combo] ORDER BY [RideData].[ROUTE] ASC;"
  12. End Sub
  13.  
Two main issues is that Access 2007 won't let me create an empty "Query1" without asking for at least one destination field. I was given the solution on this forum to use the above CurrentDb.Query Defs function in conjunction with creating a Query1 query without anything in it. Nice simple work around, but its not working now! And, I think this is why its not "behaving" properly, because I could do this in Access 2000, and it worked fine in 2003, so do I need to use a different syntax for 2007?

Thanks,
Mar 12 '08 #1
1 1493
kmartinenko
12 New Member

Expand|Select|Wrap|Line Numbers
  1.  Private Sub route_combo_AfterUpdate()
  2. Me.timepoint_combo.Requery
  3. End Sub
  4.  
  5. Private Sub Search_Click()
  6. DoCmd.OpenQuery , "Query1", acViewNormal
  7.  
  8. End Sub
  9.  
  10. Private Sub timepoint_combo_AfterUpdate()
  11. CurrentDb.QueryDefs("Query1").SQL = "SELECT * FROM [RideData] WHERE ((([RideData].[ROUTE])=[Forms]![Form1]![route_combo]))AND((([RideData].[TRIP])=[Forms]![Form1]![timepoint_combo] ORDER BY [RideData].[ROUTE] ASC;"
  12. End Sub
  13.  
Two main issues is that Access 2007 won't let me create an empty "Query1" without asking for at least one destination field. I was given the solution on this forum to use the above CurrentDb.Query Defs function in conjunction with creating a Query1 query without anything in it. Nice simple work around, but its not working now! And, I think this is why its not "behaving" properly, because I could do this in Access 2000, and it worked fine in 2003, so do I need to use a different syntax for 2007?

Thanks,
I figured it out. If anyone ever comes across this problem, you may find it useful to know that in Access 2007, they don't require extraneous code in VBA. Instead, you can simply insert your WHERE SQL statement within a "Query1", so I created a Query1, and the SQL statement is as follows:

Expand|Select|Wrap|Line Numbers
  1. SELECT RideData.ROUTE, RideData.DIR, RideData.TRIP, RideData.TIMEPOINT, RideData.SCHEDULED_TIME, RideData.[ON], RideData.[OFF], RideData.SCHEDULE_DEVIATION, RideData.SCHEDULED_RUNTIME, RideData.ACTUAL_RUNTIME, RideData.DELTA_RUNTIME
  2. FROM RideData
  3. WHERE (((RideData.ROUTE)=Forms!Form1!route_combo) And ((RideData.TRIP)=Forms!Form1!timepoint_combo));
Then, simply create a command button using the wizard, select "Run Query" and associate the command button with the query you created.

--Kindra
Mar 13 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2645
by: Jelmer | last post by:
Hi I've been trying to create an addin similar to Find & Replace from Rick Fisher that looks thru your tables / queries / forms / modules etc.. for a reference to a string and optionally let's you replace it. In order to get this to work I need to get - the tablenames and columnnames - the queries in plaintext - the properties of a form and the properties of elements contained within it
0
1331
by: kkrizl | last post by:
I've tried to research this problem, and I haven't been able to find any references to it. Probably because I shouldn't be doing it, but it was working, and now it's not. I'm trying to develop a small application to run on our intranet. I have a lot of old knowledge, and not a lot off access to new knowledge, so I'm shooting from the hip and fumbling. I have a small Access database that I'm using as a back end for some ..ASP pages. ...
1
1766
by: kkrizl | last post by:
I've tried to research this problem, and I haven't been able to find any references to it. Probably because I shouldn't be doing it, but it was working, and now it's not. I'm trying to develop a small application to run on our intranet. I have a lot of old knowledge, and not a lot off access to new knowledge, so I'm shooting from the hip and fumbling. I have a small Access database that I'm using as a back end for some ..ASP pages. ...
2
2348
by: Brian K. | last post by:
I've read several posts on this problem, since it's happening to me right now. Can't seem to get rid of this. Using A2K2 on a large XP network. PC front ends linked to a backend on a shared folder on server. Things worked great for a while (couple of months), and then last month I suddenly lost the ability to make changes to forms or code, getting the exclusive access warning. This happens even when no one is on the backend through...
6
2250
by: John | last post by:
Hi I have a vb.net app that opens an access database runs several sql action queries on the tables and closes the db. This is done every few minutes. The problem is that sometimes I get an error 'ExecuteNonQuery requires an open and available Connection. The connection's current state is closed'. My question is; is there a situation where an app automatically closes the db connection causing this error and is there a way to prevent this?...
1
1873
by: timn | last post by:
Translating Access SQL queries into SQL subqueries. -------------------------------------------------------------------------------- I have a query in Access that uses a subquery, I would like some help on translating it into SQL as a subquery so I can use it in an application. the queries in Access are the subquery... (query4) SELECT Movement.DateTime, Movement.StudentID, Movement.Subject, Movement.Teacher, Movement.Destination,...
4
2411
by: myemail.an | last post by:
Hi all, I use Access 2007 and have the following problems: when exporting banal select queries (either to Excel or to a csv file) I find that exporting often doesn't work and creates a file with the WHOLE dataset, i.e. including those rows which the criteria of the query excluded. For example: let's say I have a database with sales by region. I create a select query to only show sales from Europe. The query runs
4
3617
by: destinman via AccessMonster.com | last post by:
I just installed MS Access 2007. Is there any way to turn off the confirmation of action queries in 2007 ? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200712/1
8
4647
by: DanicaDear | last post by:
I have something interesting...looking to see if anyone else has came across this. I have a query with parameter and and the query works beautifully every time. However, when I use the wizard to build a report, at the end of the wizard the report opens beautifully, asks for the 2 parameters, and displays results. Beautiful. Then, after closing the report and re-opening, the report promts me for a third, unwanted parameter. ...
0
10135
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11299
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4910
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.