473,385 Members | 1,720 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,385 software developers and data experts.

Sort order

29
Here is what i have

I have 2 cbo boxes cboHomeArea and cboResName
I want it to sort after update the
by [resid].[last]

currentlly it is defaulted to [Resid].[resid]
any help would be great


Private Sub cboHomeArea_AfterUpdate()
Dim sManagerSource As String
sManagerSource = "SELECT [ResID].[ResID]," & _
"[resid].[homeareaid]," & _
"[resid].[last]&', '&[resid].[first]" & _
"FROM resid " & _
"WHERE [homeAreaId] = " & Me.cboHomeArea.Value
Me.cboResName.RowSource = sManagerSource
Me.cboResName.Requery

End Sub
Jan 22 '08 #1
8 1593
frys
29
Any help would be great
Jan 23 '08 #2
frys
29
I could use a little help with this
Feb 5 '08 #3
Rabbit
12,516 Expert Mod 8TB
Use the ORDER BY clause.

Expand|Select|Wrap|Line Numbers
  1. SELECT Field1
  2. FROM Table1
  3. ORDER BY Field2;
  4.  
Feb 5 '08 #4
frys
29
i know the syntax... but it after running it with an orderby it shows me nothing
that or it says improper use of data... im not good with VBA to begin with but i think its pretty self explainitory

dim sMangerSource as string

smanagersource="Select [resid].[resid]," & _
"[resid.last]&', '&[resid].[first]," & _
"[resid].[homearea]" &-
"from [resid]"
"where [resid].[homearea]=" me.Homeareacbo.value & _
"order by [resid].[last]"
Me.cboResName.RowSource = sManagerSource
Me.cboResName.Requery

but this is not right..... why...
Feb 7 '08 #5
Rabbit
12,516 Expert Mod 8TB
Your spacing is off.

Expand|Select|Wrap|Line Numbers
  1. "SELECT *" & "FROM" & "Table1;"
  2.  
will give you
[code=sql]
SELECT *FROMTable1;"
Feb 7 '08 #6
frys
29
Your spacing is off.

Expand|Select|Wrap|Line Numbers
  1. "SELECT *" & "FROM" & "Table1;"
  2.  
will give you
[code=sql]
SELECT *FROMTable1;"
I really appreciate the help Rabbit
but. .. i think i need some more training before i battle VBA... this simple code isn't working no matter which way i write it...

thanks anyway
Feb 8 '08 #7
Rabbit
12,516 Expert Mod 8TB
All you need to do is get your spacing correct:

Expand|Select|Wrap|Line Numbers
  1. dim sMangerSource as string
  2.  
  3. smanagersource="Select [resid].[resid]," & _
  4. "[resid.last] & ', ' & [resid].[first]," & _
  5. "[resid].[homearea] " & _
  6. "from [resid] " & _
  7. "where [resid].[homearea]=" me.Homeareacbo.value & _
  8. " order by [resid].[last];"
  9. Me.cboResName.RowSource = sManagerSource
  10. Me.cboResName.Requery
  11.  
Feb 8 '08 #8
frys
29
Thanks ever so much.. i finnally got it to work.... you where very right the spacing was off..

These little things can cause so much trouble
Feb 19 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: its me | last post by:
Let's say I have a class of people... Public Class People Public Sex as String Public Age as int Public Name as string end class And I declare an array of this class...
2
by: One's Too Many | last post by:
Ran into a strange problem today: 8.1.7 on AIX 4.3.3 Database and applications had been working fine for two years and all of a sudden a couple of regularly-run queries are now no longer...
20
by: Xah Lee | last post by:
Sort a List Xah Lee, 200510 In this page, we show how to sort a list in Python & Perl and also discuss some math of sort. To sort a list in Python, use the “sort” method. For example: ...
7
by: Steve Crawford | last post by:
I am suffering some sort order confusion. Given a database, "foo", with a single character(4) column of data left padded with spaces I get: select * from foo order by somechars; somechars...
2
by: adrian.chandler | last post by:
Hi all, I have been using letter and symbol codes such as GNU< GNU\ GNU} GNU in an Access table. I was surprised to see that when the table was sorted on this field, the order is: GNU...
5
by: Jan Smith | last post by:
I've searched the overloads for the Array.Sort method, and I haven't found a clear answer to my question. Maybe it's not in Array.Sort. Here's the question: I initialize an array X with the...
2
by: Patrick | last post by:
I got a page that loads a xml file into a treeview control. I want it to sort the data before sending it to the treeview control is that possible? <root> <level1 name="" src="" order="0">...
6
by: weetat.yeo | last post by:
Hi all , I have sql statement below , SELECT serial_no,host_name,chasis_model,chasis_flash_size,chasis_dram_size,...
15
by: bcochofel | last post by:
Hi, I want to use a variable to sort elements. That var his passed with query string (I'm using Perl CGI to generate XML). Here's a sample of my output:...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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.