Rabu, 06 Maret 2013

[MS_AccessPros] VBA incorp SQL with number values

 

i have a table with accounting chart of accounts which is the tables key id

what i need is the list to change when i press current assets or what ever and the codes with the discriptions are displayed in the list box

Private Sub Frame8_AfterUpdate()
Dim SQLText, textbox
'Dim dbs As Database
Dim rst As Recordset

Select Case Frame8
Case 1
SQLText = "SELECT Assistance_chart.Code, Assistance_chart.Description " _
& "FROM Assistance_chart ORDER BY Assistance_chart.Code; "

Case 2
' Modify this line to include the path to Northwind
' on your computer.
' Set dbs = OpenDatabase("NewAdministration.mdb")

' List the name and contact of every catergory
' who placed in order by value code


Set rst = dbs.OpenRecordset("SELECT Assistance_chart.Code," _
& " Assistance_chart.Description" _
& " FROM Assistance_chart" _
& " WHERE Code" _
& " IN (SELECT Code FROM code" _
& " WHERE code Between #1001#" _
& " And #1010#);")

' Populate the Recordset.
rst.MoveLast

' Call EnumFields to print the contents of the
' Recordset. Pass the Recordset object and desired
' field width.
' EnumFields rst, 25

'dbs.Close

' SQLText = "SELECT Assistance_chart.Code, Assistance_chart.Elite, Assistance_chart.Description " _
& "Assistance_chart.AccountType, Assistance_chart.TAG " _
& "FROM Assistance_chart WHERE Assistance_chart.Code Between 1001 And 1998; "

'SQLText = "SELECT Assistance_chart.[Code], Assistance_chart.[Description]" _
& "Assistance_chart.[AccountType]FROM Assistance_chart WHERE (((Assistance_chart.[Code]) Between 1001 And 1010));"

' SQLText = "SELECT sheet2.Code, sheet2.Description, sheet2.Type, sheet2.GST, sheet2.Group, sheet2.Section " _
& "FROM sheet2 WHERE (((sheet2.Group) like '1. Manufacturing' ));"

' textbox = "Manufacturing 1 - 50"


End Select
Me!ListBox1.RowSource = strSQL 'Text

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar