×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

ADO Help

ADO Help

ADO Help

(OP)
I have a small VB App that I'm currently writing that has an ADO control that controls a Dropdown Box as well as a Textbox.  They work great using the ADO control, however, I want to hide the ADO Control and use just the selections from the Dropdown box to drive the correct results in the Textbox.  Can anyone steer me in the right direction with some code snippets to accomplist this task?

RE: ADO Help

Are you using the adodc control? If so, this control has a visable property that you can select false.

Hope this helps.

Christina

RE: ADO Help

(OP)
I know that I can hide the ADO control, but thats not what my question was.

RE: ADO Help

Hi,

So what is your question ?. Do you want to hide the ADO control or you want to do it without using an ADO control.

Because if its the former then whats wrong with the former post.

If its the latter then what are you selecting in the drop down box and what effect do you want on the text box ?

Any help ?, yes no let me know.

Regards

RE: ADO Help

(OP)
I hope that this is a little clearer.
I have hidden my ADO control on my GUI.
Currently my dropdown Box is populated by the ADO control,
as well as the texstbox, and they work well together using ADO.

But what I actually want is instead of using the ADO control to populate the textbox, I want to select an item in the dropdown box and have the correct field from my .mdb file displayed in the textbox, just as it is when I use the ADO control.

Any help will be greatly appreciated.

RE: ADO Help

jmagee,

If you are going to make the ADO Data control invisible, what is the need to include it in the form ? You can do all database accesses programmatically.

First make a reference to Microsoft ActiveX Data Objects 2.1 Library from the <Project> <References> menu. (My version is 2.1, yours may be different).

***********CODE STARTS HERE*****************
Dim cnn1 as ADODB.Connection
Dim rs1 as ADODB.Recordset
Dim strFind as String
Set cnn1 = New ADODB.Connection
cnn1.ConnectionString  "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=c:\example.mdb"

' If mdb file is Access 2000, you should use 4.0 instead of 3.51

  cnn1.CursorLocation = adUseClient 'Client side cursor
  cnn1.Open  'Open the connection
  Set rs1 = New ADODB.Recordset
  strFInd = "'" + dropdown.text + "'" 'Use the Text value of drop down list here. Be sure to add the single quotes
  rs1.Open "Select * From ExampleTableName Where ExampleColumn = " + strFInd, cnn1, adOpenDynamic, adLockBatchOptimistic
 
'If there is only one matching record, you can assign its value to the text box like this

textbox.text= rs1.fields(1) 'Second column.

'Then unload the objects
  Set cnn1 = Nothing
  Set rs1 = Nothing
***********CODE ENDS HERE****************************

Hope this helps,


Sajith

RE: ADO Help

How can I open a dynamic recordset in VB for an Access database? I am using ADO and I want to be able to use ado_recordset.MovePrevious.

Thanks,
Jordan

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close