473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help write a SQL in VBA

Hello all

How do I write this SQL in VBA code:
SELECT DISTINCTROW Employees.UsernameHold, [Expense
Reports].ExpenseReportID, [Expense Reports].EmployeeID, [Expense
Reports].ExpenseType, [Expense Reports].ExpenseRptName, [Expense
Reports].ExpenseRptDescr, [Expense Reports].DateSubmitted, [Expense
Reports].DepartmentCharged, [Expense Reports].BusinessPurpose, [Expense
Reports].[Period Ending], [Expense Reports].[End Milage], [Expense
Reports].[Start Milage], [Expense Reports].[Bus Miles] FROM Employees
INNER JOIN [Expense Reports] ON Employees.EmployeeID=[Expense
Reports].EmployeeID WHERE (((Employees.UsernameHold)=CurrentUser()) AND
(([Expense Reports].EmployeeID)=[forms]![Expense Reports by
Employee]![EmployeeID]));

Like I know how to write:
SELECT Employees.EmployeeID, Employees.DepartmentName,
Employees.EmployeeNumber, Employees.FirstName, Employees.LastName,
Employees.Notes, Employees.[Auto Year], Employees.[Auto Condition],
Employees.[Auto Make], Employees.UsernameHold FROM Employees

-----Me.RecordSource = "SELECT * FROM Employees"
But I dont know how to write the other SQL, Can somebody tell me please

Thank you in advance

Aug 16 '06 #1
4 1706

SELECT [Expense Reports].ExpenseReportID, [Expense Reports].EmployeeID,
[Expense Reports].ExpenseType, [Expense Reports].ExpenseRptName,
[Expense Reports].ExpenseRptDescr, [Expense Reports].DateSubmitted,
[Expense Reports].DepartmentCharged, [Expense Reports].BusinessPurpose,
[Expense Reports].[Period Ending], [Expense Reports].[End Milage],
[Expense Reports].[Start Milage], [Expense Reports].[Bus Miles],
[Expense Reports].UsernameHold
FROM [Expense Reports]
WHERE ((([Expense Reports].EmployeeID)=[forms]![Expense Reports by
Employee]![EmployeeID]));

This is the SQL that I need to write in VBA not the last I posted

Aug 16 '06 #2
Never mind, I got it :-)

Aug 16 '06 #3

Ups, no!....still need help, sorry about that

Any ideas ?

Aug 16 '06 #4

Me.RecordSource = "SELECT [Expense Reports].ExpenseReportID, [Expense
Reports].EmployeeID, " & _
"[Expense Reports].ExpenseType, [Expense Reports].ExpenseRptName, " & _
"[Expense Reports].ExpenseRptDescr, [Expense Reports].DateSubmitted, " & _
"[Expense Reports].DepartmentCharged, [Expense Reports].BusinessPurpose, " &
_
"[Expense Reports].[Period Ending], [Expense Reports].[End Milage], " & _
"[Expense Reports].[Start Milage], [Expense Reports].[Bus Miles], " & _
"[Expense Reports].UsernameHold " & _
"FROM [Expense Reports] " & _
"WHERE ((([Expense Reports].EmployeeID)=[forms]![Expense Reports by
Employee]![EmployeeID]));"

Aug 16 '06 #5

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

Similar topics

4
by: PHPkemon | last post by:
Hi there, A few weeks ago I made a post and got an answer which seemed very logical. Here's part of the post: PHPkemon wrote: > I think I've figured out how to do the main things like...
5
by: Tank | last post by:
I have had this post up here when i was trying to figure out how to make leading zeros and have been able to fudge that to work. I am now have trouble getting the loop that makes the folders to...
1
by: rainbowii7 | last post by:
Calling all programmers for helllllllllllllllppppp!!! i am currently doing a uni degree and our lecturers have set us the task of making a game in JavaScript. i chose to do a hangman game and...
0
by: Shaggyh | last post by:
hi im needing help with a program im writing to do subnetting i was on before about it and i got some help. the code below wont work for me and i cant think of why not. i was wondering if anyone...
1
by: aarthy | last post by:
Hi, I have a problem in the display of the ASP screen actually i am retrieving and displaying the data from a database when the view button is hit.The contents for display is so long so i want...
5
by: althafexcel | last post by:
hi everyone Im trying to include an external js in my aspx page under the head tag, it doesn't load or it displays an object expected error whenver the function from the .js is called. Actually...
9
by: TF | last post by:
Hello all, I made a ASP.NET 2.0 site that shows possible "recipes" for paint colors stored in an access dbase. Basically, 1000 colors are stored with specific RGB values in separate columns. A...
1
by: dsoutherland | last post by:
I am so new to ASP I'm not sure I am breathing. A company one of my clients deals with provides information over the web. They provided the ASP code for a default web site that is used to...
6
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID,...
1
by: maxxxxel | last post by:
Hi Can anyone help me with some asp code , I changed the code to use CDO.message instead of the old cdont.sys to send mail from a ASP webpage which works fine. Our problem is that when we send...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...

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.