Hi !!
I want to load the data into List Box from Access Data base
How can i set it dynamically, so that i can select the values in the list box
Hi !!
I want to load the data into List Box from Access Data base
How can i set it dynamically, so that i can select the values in the list box
Welcome to the forums.
What programming language are you using? Access VBA?
Please use [Code]your code goes in here[/Code] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.
Creating A Wizard In VB.NET
Paging A Recordset
What is wrong with using On Error Resume Next
Good Article: Language Enhancements In Visual Basic 2010
Upgrading VB6 Code To VB.NET
Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
Hi Hack,
Its in Excel User Forms List Box i want to load the data from Excel...
I am using the above code to store the data to Access From Excel, Similarly I am looking for info on how to load the data from Access to Excel Forms List Box.Code:Dim db As Database, rs As Recordset, r As Long, dt As String Set db = OpenDatabase("C:\Invoice\Invoice.mdb") Set rs = db.OpenRecordset("InvoiceTbl", dbOpenTable) With rs .AddNew ' create a new record dt = invmon.Value & "-" & invdt.Value & "-" & invyear.Value .Fields("InvoiceDate") = dt .Fields("CompanyID") = 1 ' add more fields if necessary... .Update ' stores the new record End With rs.Close Set rs = Nothing db.Close Set db = Nothing MsgBox "Data has been saved in access"
Hi !!
I am using Excel Forms and want to load the data from Access to List Box and data can be selected from the List Box in forms.
I am using above code to store the data into Access from Excel...Code:Dim db As Database, rs As Recordset, r As Long, dt As String ' connect to the Access database ' Set cn = New ADODB.Connection Set db = OpenDatabase("C:\Invoice\Invoice.mdb") ' open the database Set rs = db.OpenRecordset("InvoiceTbl", dbOpenTable) With rs .AddNew ' create a new record ' add values to each field in the record dt = invmon.Value & "-" & invdt.Value & "-" & invyear.Value .Fields("InvoiceDate") = dt .Fields("CompanyID") = 1 ' add more fields if necessary... .Update ' stores the new record End With rs.Close Set rs = Nothing db.Close Set db = Nothing MsgBox "Data has been saved in access"
Now i want to show the data to List Box of User Forms by getting the data from Access DB.
Excel VBA question moved to Office Development
Please use [Code]your code goes in here[/Code] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.
Creating A Wizard In VB.NET
Paging A Recordset
What is wrong with using On Error Resume Next
Good Article: Language Enhancements In Visual Basic 2010
Upgrading VB6 Code To VB.NET
Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
Team,
Any updates on this request... How can i show the Access data in the Excel List Box of User Forms... I had posted the code which i am using to store the data from Excel to List Box but how could i do the reverse of it...
alternatively you can use an sql query to populate the recordset, with only the desired results from the tablevb Code:
Set db = OpenDatabase("C:\Invoice\Invoice.mdb") ' open the database Set rs = db.OpenRecordset("InvoiceTbl", dbOpenTable) ' first part stays the same do until rs.eof listbox1.additem rs(f) ' where f is the index of the field to fill the listbox rs.movenext loop
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed![]()
pete
sql query something like this to open only where the field name 'FirstName' has 'seenu'
Code:Set rs = db.OpenRecordset("select * from MyTable where FirstName='seenu'")
Seenu
If this post is useful, pls don't forget to Rate this post.
Pls mark thread as resolved once ur problem solved.
ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms
Hi Seenu,
I was trying to access using the SQL but was getting TypeMismatch issue....
Code:Dim db As Database, rs As Recordset, r As Long Set db = OpenDatabase("C:\Invoice\Invoice.mdb") Set rs = db.OpenRecordset("select BName from BrokerTbl") Do Until rs.EOF Invoice_Preparation.brokername.AddItem rs rs.MoveNext Loop rs.Close Set rs = Nothing db.Close Set db = Nothing
kiran, try like this
Code:Invoice_Preparation.brokername.AddItem rs!BName
Seenu
If this post is useful, pls don't forget to Rate this post.
Pls mark thread as resolved once ur problem solved.
ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms