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

Home Posts Topics Members FAQ

HELP with VBA Code for Unmatched Query

Hello,

I am trying to use access vba instead of running an unmatched query.
I want to compare two tables and if there is a new sales office in
"Commission s" table that is not in the "Conversion " table I want to
know which region.
I'm lost. Can someone help? Here is my code.

Sub now()

Dim CurDb As Database
Dim rst As Recordset
Set CurDb = CurrentDb

Set rst = CurDb.OpenRecor dset("SELECT Commissions.[SALES OFFICE]"
& _
"FROM Commissions LEFT JOIN [Sales Office Conversion] ON
Commissions.[SALES OFFICE] = [Sales Office Conversion].Sales_Office" &
_
"GROUP BY Commissions.[SALES OFFICE], [Sales Office
Conversion].Sales_Office" & _
"HAVING ((([Sales Office Conversion].Sales_Office) Is
Null))" & _
"ORDER BY Commissions.[SALES OFFICE]")

With rst
MsgBox Commissions.[SALES OFFICE]
End With

rst.Close
Set rst = Nothing
End Sub

Sal
Nov 12 '05 #1
2 3708
sa************* *@adp.com (sal cifone) wrote in message news:<4b******* *************** ****@posting.go ogle.com>...
Hello,

I am trying to use access vba instead of running an unmatched query.
I want to compare two tables and if there is a new sales office in
"Commission s" table that is not in the "Conversion " table I want to
know which region.
I'm lost. Can someone help?


Sal,
why not just leave the unmatched query and pass parameters to it?
Then you could just open the recordset off the querydef and be done
with it. MUCH easier than doing it with code. The only difference is
that you'd open your recordset off the query (after passing parameters
to it). Then if you open a recordset with the region field in it, you
can just return that/those values if there are any. (use a snapshot
recordset and you can do a reliable recordcount).
Nov 12 '05 #2
Thanks for the reply,

I am a newbie when it comes to Access VB. I do not know how to do what
you suggest.
Sal

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

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

Similar topics

1
2638
by: Randy | last post by:
Access= 2002 I'm NOT a Programmer, but I have used VB in the past to do some things ( Spaghetti Code King) so I have some understanding of Coding I need to replace a text field (teacher) in Table (attendance) with a lookup fileld. the lookup field will point to a newly created table (teachers) the original DB was never intended to do the job that it is doing, but
5
1789
by: Bob Weisenburger | last post by:
I have a table of "memos". each record in that table has a primary key "memo ID" that is autonumber. I have another table that is "memo receipts" with each record having a "receipt id" field that is not a primary key. When a user reads a memo, I create a receipt record that shows that they have read and acknowledged the memo. "receipt id" is set equal to "memo id". I have this part working fine. Next what I want is when a user checks...
5
5380
by: Michael C via AccessMonster.com | last post by:
Hello, I have a table that I am appending 3 seperate tables into. My main problem is that each time I append the data, it simply adds to the data already there. That might sound ok, except that if I append the data 3 times in succession, it copies the same data over 3x. Now I have copies in triplicate. It used to only transfer records that weren't already there, but not anymore. If I can't get the append to append correctly, I was...
17
2034
by: OdAwG | last post by:
Just some questions regarding tables. I am new Access Database and need a little help. I have the following data listed below 01. I have a table called tbl_Customer with the following information listed below 02. In that table I have three columns that have numeric data in it (City, State, Marital_Status) 03. I need to convert the numeric data in table tbl_customer (City, State, Marital_Status) to alpha numeric data 04. using the...
20
2457
lagomorphmom
by: lagomorphmom | last post by:
Hi, I'm a microbiologist but also dabble with many of the computer needs of our little lab. My latest project involves an unfinished database (Access 2000 format, I'm running 2003 on XP PC) inherited from a vendor. Although I've not used Access before, I've been plugged along with the help of our data manager (currently out with hip surgery) and guess I'm an intermediate user now. I do not know VBA although several misc. programming classes...
1
1996
by: rfranzl | last post by:
Hello, I need some help, I have about 200 databases that are copies of an original database that has a similiar table in all of the databases, called "tblCodebook". What I am trying to do is to create a macro that will go into each of the 200 databases, run an identical "unmatched query" to find any records that might be in one of the copies of the "tblCodebook". There is a shared primary key in the "tblCodebook" which is a StoryID and...
16
3523
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for renaming the duplicate records? My thinking was to take the results of the duplicate query, and somehow have it number each line where there is a duplicate (tried a groups query, but "count" won't work), then do an update query to change the duplicate to...
2
2668
by: ilikebirds | last post by:
In 1 Database(ttt) I currently have a Union Query that collects data from 4 databases (a,b,c,d) and then a MakeTable query that combines all of those into a table. ( Union A,B,C,D to make table in TTT) How would I go forth to only Append New data that comes from the UNION of A,B,C,D to the Table in TTT ? Should I use an Unmatched Query with criteria and then run the Append Query off of the Unmatched Query? I run into a problem...
0
1954
by: Sharon V | last post by:
This is driving me crazy - my unmatched query wizard will not display field names for any tables I choose. All my other query wizards work properly. I am running Access 2003. I have tried using both 2003 and 2000 formats. It's not my access databases because the wizard works correctly over the network using other people's Access software. It is with every Access mdb database I have tried. I have checked every setting imaginable but...
0
9530
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
10236
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...
0
9055
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...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6793
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();...
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
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.