Thank you for the reply.
There's nothing wrong with the Select Unique statement. And I've also tried movelast, movefirst. It still returns -1.
However, I've found another way to return the total record by using Do...Loop Until, MoveNext, and then saving the total = total + 1 until rst.EOF...
I'm taking the data from ODBC used in Excel.
The one makes me confused is,
I'm setting a criteria for the data pulled, exp.
if Name = A, Name = B, etc.
When it goes to Name = A, the rst.recordcount does return a number ( = 5), also for B ( = 15). But only when Name = E, the rst.recordcount...
Hi all,
I just did a Select Unique to return a recordset.
I'm using rst.movelast
then rst.recordcount to return the total records.
It keeps giving me -1 instead of the real number.
I know it's not much , only 100, so how come it didn't work as it's supposed to be?
Thanks ahead,
Tin Tin
Hi,
I thought previously you said you've been able to create the string already, that's why I just mentioned the control source part.
Well, basically this is the whole process that I've tried and worked just fine.
For example:
In the form that have TableA as record source, you have bound...
You can use LEFT JOIN in the SQL statement.
After making a query in the design view by combining 2 tables, go to View, SQL View. Change the word "INNER" in the statement to "LEFT". That way, it will display all data in the left table and the matching data in the right table...
In the design view "Criteria" just type:
>=[Forms]![FormName]![StartDate] And <=[Forms]![FormName]![EndDate]
It means, it will query data that starts in StartDate and ends in the EndDate.
Good luck.
Hi Nicky,
yes, you can use VBA to do 'Make Table Query'.
Use "SELECT fields INTO new table FROM source WHERE criteria".
Take a look at your built-in make-table query, go to VIEW - SQL. That's how you create a SQL statement in module. You just have to add the WHERE criteria if you...
Hi,
I tried to write just:
ActiveSheet.Range("A" & X + 1 & ":" & "F" & X + 1).Select
and the rest
It does work fine.
So, I guess the problem is the var 'objNewXLBook' has not been declared/set yet.
Tin Tin
Here it is:
x = DCount("[Field1]", "Table1", "[Field1] = Yes")
y = DCount("[Field1]", "Table1", "[Field1] = No")
Good luck,
Tin Tin
Hi,
I need help to built a query based on a list.
I have 2 worksheets,
the first one contains some list of datas.
The second one will be populated with data from database which is not in the first worksheet.
I tried to create both queries directly in the code, such as query data where...
Actually, we'll need one more parentheses to close it, or delete one from the first WHERE clause.
This error actually reminds me that whenever I run a query that takes quite a long time, I always got a "Execution failed" message.
Is this actually a problem with the time set up?
I'm...
Hi all,
I've been overwhelmed with this for 2 days, still cannot find what is missing. Perhaps you can help me with this.
I'm using pass-through SQl to take data directly from Oracle DB.
Here's the result from debug.print vSQL:
[b]SELECT
Name,
Account_ID,
Account_Team...
Okay, I'm taking the data from the oracle, and here's the complete syntax:
vSQL = "SELECT Count(Account) AS TotalCount FROM TB_OPTY_V Where (Sales_Team = '" & iName(i) & "') AND
(mid(Sales_Stage,1,1)= '" & i & "')"
If I dismiss the second criteria, it works fine...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.