Hi dear all, I have a piece of code about export different queries into multiple worksheet in one excel file. The query "DivideGroup" is a crosstab query, and the data value in "DivideGroup" should change in each loop depending on the grouping factors. Now I can get my first loop right, but the...
Sorry, here is the code...not familiar with the forums...lol
Private Sub ExprDetail_Click()
Dim db As DAO.Database
Dim qdf1 As DAO.QueryDef
Dim qdf2 As DAO.QueryDef
Dim rst As Recordset
Dim recordCnt As Integer
Dim recordNm As Integer
Dim sql As String
Dim arrStr As String
Dim arrCount() As...
Hi dear all, I have piece of code which is about to export different query into multiple worksheets in one excel file. Queries are made from distinct value of one recordset, I cam get the first loop successfully, but when it move to the second recordset, the result I got is the sum of two...
Hi all, I have a query with 5 field, [Country],[Province],[GroupingInfo],[City],[Area]
I want to write or build a new query to have something on the [City] critiria like:
IIf [City]="NoInfo" And [GroupingInfo]<=1 Then [City]=[Province], else [City] = [City]
This is on the Query Sql, not on...
Hi, sorry for the confuse, what I acturely mean is, Can anyone tell me how to write code to built a loop? Since I think I will need to develop a array for check each column, start from column4 to column 6. I think the loop may be like:
With rst
.MoveLast
.MoveFirst
If...
hahaha, Sorry I am new to the VBA programming, so I just want a store sql or query in VBA by sort of array thing, instead of create a bench of query in my database, since the initial query size is undefined (base on the selection). So I intend to creat first sql on VBA, and I will use my code to...
Hi All, I am working on write Sql in VBA and I want to save this query into a array table. Since I will change my Sql later,so the array size can not be defined now. I haven't done any code with array before, can anyone give me some example or hints on how to do that? Thanks!
So an example of...
Now I get another error, Run-time error'3075': Syntax error(missing operator) in query expression 'Species IN('
Again, here is my code
Private Sub Spc_Slc_AfterUpdate()
Dim dbs As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT SpeciesRef, Species...
Private Sub Spc_Slc_AfterUpdate()
Dim dbs As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT SpeciesRef, Species FROM Species WHERE Species IN (" & strCriteria & ") ORDER BY Species"
Debug.Print strSQL
Set rs = dbs.OpenRecordset(strSQL) <== this line gives error...
I have a multi select list box called "Spc_Slc" and want to pass the selected value as criteria to the field called "Species" in my query. I don't know how to connect the code to my query without click command button, because I only want to use the query as data source to my other form. I have...
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.