473,796 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Query in VB?

Jim
How do I program visual basic to create a "Find Unmatched Query"?

I have two tables:

- TodaysImport
- YesterdaysImpor t

Both tables have the same 6 fields:

- User
- User Name
- Curriculum
- eMail
- OpGroup
- UserCurriculum

The UserCurriculum field is the key field that I want to find the
unmatched records on. I want the results from TodaysImport to show me
the records that were not in the table YesterdaysImpor t.

Any help would be appreciated!

Aug 8 '07 #1
7 3781
Is there some reason not to use the Find Unmatched Query Wizard to generate
the pattern and then use that as the basis for your VBA code?

Just an idle question: what is the definition of the "user curriculum"
field? If it is not a unique value for each record, you will have to
further clarify what makes the records different.

Larry Linson
Microsoft Access MVP

"Jim" <jl*******@gmai l.comwrote in message
news:11******** **************@ x40g2000prg.goo glegroups.com.. .
How do I program visual basic to create a "Find Unmatched Query"?

I have two tables:

- TodaysImport
- YesterdaysImpor t

Both tables have the same 6 fields:

- User
- User Name
- Curriculum
- eMail
- OpGroup
- UserCurriculum

The UserCurriculum field is the key field that I want to find the
unmatched records on. I want the results from TodaysImport to show me
the records that were not in the table YesterdaysImpor t.

Any help would be appreciated!

Aug 8 '07 #2
something like this:

dim sql as string

sql = "create procedure UnmatchedRecord s as " _
& "select * from TodaysImport as t " _
& "where not exists(" _
& "select * from YesterdaysImpor t as y " _
& "where y.UserCurriculu m = t.UserCurriculu m)"

currentproject. connection.exec ute sql , , adexecutenoreco rds

Jim wrote:
How do I program visual basic to create a "Find Unmatched Query"?

I have two tables:

- TodaysImport
- YesterdaysImpor t

Both tables have the same 6 fields:

- User
- User Name
- Curriculum
- eMail
- OpGroup
- UserCurriculum

The UserCurriculum field is the key field that I want to find the
unmatched records on. I want the results from TodaysImport to show me
the records that were not in the table YesterdaysImpor t.

Any help would be appreciated!
Aug 8 '07 #3
Jim
On Aug 8, 10:54 am, "Larry Linson" <boun...@localh ost.notwrote:
Is there some reason not to use the Find Unmatched Query Wizard to generate
the pattern and then use that as the basis for your VBA code?

Just an idle question: what is the definition of the "user curriculum"
field? If it is not a unique value for each record, you will have to
further clarify what makes the records different.

Larry Linson
Microsoft Access MVP

"Jim" <jlrehm...@gmai l.comwrote in message

news:11******** **************@ x40g2000prg.goo glegroups.com.. .
How do I program visual basic to create a "Find Unmatched Query"?
I have two tables:
- TodaysImport
- YesterdaysImpor t
Both tables have the same 6 fields:
- User
- User Name
- Curriculum
- eMail
- OpGroup
- UserCurriculum
The UserCurriculum field is the key field that I want to find the
unmatched records on. I want the results from TodaysImport to show me
the records that were not in the table YesterdaysImpor t.
Any help would be appreciated!- Hide quoted text -

- Show quoted text -
You're right Larry, I didn't think about it. Here's the SQL from the
query, so how do I get Access to create the query?

SELECT TodaysImport.Us er, TodaysImport.[User Name],
TodaysImport.Cu rriculum, TodaysImport.eM ail, TodaysImport.Op Group
FROM TodaysImport LEFT JOIN YesterdaysImpor t ON
TodaysImport.Us erCurriculum = YesterdaysImpor t.UserCurriculu m
WHERE (((YesterdaysIm port.UserCurric ulum) Is Null));

Aug 8 '07 #4
On Wed, 08 Aug 2007 11:57:05 -0400, John Winterbottom
<jo*****@rogers .cawrote:

Alternatively if you want to use the DAO methods:
'air code follows
dim q as DAO.Querydef
set q = CreateQuerydef( "qryName", "select ...")
currentdb.query defs.refresh

-Tom.
>something like this:

dim sql as string

sql = "create procedure UnmatchedRecord s as " _
& "select * from TodaysImport as t " _
& "where not exists(" _
& "select * from YesterdaysImpor t as y " _
& "where y.UserCurriculu m = t.UserCurriculu m)"

currentproject .connection.exe cute sql , , adexecutenoreco rds

Jim wrote:
>How do I program visual basic to create a "Find Unmatched Query"?

I have two tables:

- TodaysImport
- YesterdaysImpor t

Both tables have the same 6 fields:

- User
- User Name
- Curriculum
- eMail
- OpGroup
- UserCurriculum

The UserCurriculum field is the key field that I want to find the
unmatched records on. I want the results from TodaysImport to show me
the records that were not in the table YesterdaysImpor t.

Any help would be appreciated!
Aug 9 '07 #5
"Jim" <jl*******@gmai l.comwrote
You're right Larry, I didn't think about it. Here's the SQL from the
query, so how do I get Access to create the query?

SELECT TodaysImport.Us er, TodaysImport.[User Name],
TodaysImport.Cu rriculum, TodaysImport.eM ail, TodaysImport.Op Group
FROM TodaysImport LEFT JOIN YesterdaysImpor t ON
TodaysImport.Us erCurriculum = YesterdaysImpor t.UserCurriculu m
WHERE (((YesterdaysIm port.UserCurric ulum) Is Null));
In Access 2003 or earlier, in the Database Window, Queries tab, click the
New button and Find Unmatched is one of the options. Should do what you
want... I didn't attempt to recreate your table structure to try it, though.

In Access 2007... somebody else will have to take the question. I'm not
using it yet.

Larry Linson
Microsoft Access MVP
Aug 10 '07 #6
Hi,
In Access 2003 or earlier, in the Database Window, Queries tab, click
the New button and Find Unmatched is one of the options. Should do
what you want... I didn't attempt to recreate your table structure to
try it, though.
In Access 2007... somebody else will have to take the question. I'm
not using it yet.
;-)

In A07 the Query Wizard is located on the Ribbon "Create" (Group Other)

Regards
Jens

Aug 10 '07 #7
Jim
Thanks everyone, the following code worked!

'Create query
Dim createSQL As String
createSQL = "create procedure TodaysNewRecord s as SELECT
TodaysImport.Us er, TodaysImport.[User Name], TodaysImport.Cu rriculum ,
TodaysImport.eM ail, TodaysImport.Op Group FROM TodaysImport LEFT JOIN
YesterdaysImpor t ON TodaysImport.Us erCurriculum =
YesterdaysImpor t.UserCurriculu m WHERE
(((YesterdaysIm port.UserCurric ulum) Is Null));"
CurrentProject. Connection.Exec ute createSQL, , adExecuteNoReco rds

Aug 10 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3061
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I write some PHP code which should, I think, be able to to auto create the tables. The SQL looks like this:
8
7591
by: Donna Sabol | last post by:
First, I should start by saying I am creating a database to be used by some very impatient, non-computer literate people. It needs to be seameless in it's operation from their point of view. I want them to do as little as possible when they run their reports. I have a crosstab query that displays usage of items for each month. It looks pretty much like this: ITEM DESC UM 12/02 1/03 2/03 3/03 ...ETC. 1 Solution ...
6
2779
by: sheree | last post by:
I would like to create a query where one of the columns of the queries comes from a combo list box on a form. For example, if my table has the following fields: id name interest1 interest2 interest3 my combo box would be a dropdown containing these choices:
4
7749
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query, but I can't update record in query or in form. I believe the problem is due to the source query. In source query, there is a filter to show the incomplete record ("is null" in delivery date)], but I need to re-use the job no. if the job is...
18
6646
by: PC Datasheet | last post by:
An Access user saw my name in a newsgroup and sent me a request for help on a project. As part of the project, a list of the dates in a month was needed. For anyone needing a list of dates in a month, here is what I used: 1. Create a table named TblNumbers with one field named Num and populate the table with 1 to 31 2. Create a query based on TblNumbers 3. Pull down Num into the first field of the query. 4. Put the following...
13
2870
by: forbes | last post by:
Hi, I have a user that used the Query Wizard to create a query in Access. Now she claims that her master table is missing all the data that was excluded from the query. Can you create anything other than a select query using the Wizard? What do you think happened to her data? I am working remotely until Friday, so I can't get down to her office and check out what she did.
2
9451
by: angie | last post by:
I need to figure out how to create a user interface to search a query, but here's the bad part...I need to account for criteria on at least 7 of the fields. Here's what I'm thinking I need to do: Create an unbound form with unbound fields for all 7 of the fields in the query. Then in the query create parameters that refer to those fields. But it's not that simple because the user needs the flexibility of filling in as many or as few...
8
3482
by: chrisdavis | last post by:
I'm trying to filter by query or put those values in a distinct query in a where clause in some sort of list that it goes through but NOT at the same time. Example: ROW1 ROW2 ROW3 ROW4 , etc. I want to go to the first row, do a WHERE statement, return the
15
2690
by: harvey | last post by:
How do I make PHP create a database for mysql please? I can see how to make tables and I have read all the documents I can find but I don't understand how to make the database itself. All the tutorials I can find seem to bypass the issue by ignoring it? Am I missunderstanding something?
3
18721
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however, working with complex reports is tricky Assumption: Reader of this article have basic knowledge of creating data reports. Creating a Parent-Child Command and create a DataReport Suppose we have a database called company with two tables ...
0
9685
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
9531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
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
10237
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
10187
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
6795
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
5446
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...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
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

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.