Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Connecting Textbox To Adodc Control


Please help!!!!

One of the forms in my VB program has an Adodc control and several text boxes that I want to display the contents of a record in an Access 2000 database.

I don't want to set the Adodc control's ConnectionString and RecordSource properties using the Properties Window. I want to do it in code, and the following code works for that:

Private Sub Form_Load()
adoSearchResults.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program FilesMicrosoft Visual StudioVB98HootersTrivia.mdb;Persist Security Info=False"
adoSearchResults.RecordSource = "Select * From tblQuestionsAndAnswers"
End Sub

The problem is setting the text boxes' DataSource and Data Field properties. This book I have says if I set the adodc control's ConnectionString and RecordSource properties with code that I have to set at least 1 of the text box's DataSource and DataField properties with code too. So now my code looks like this:

Private Sub Form_Load()
adoSearchResults.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program FilesMicrosoft Visual StudioVB98HootersTrivia.mdb;Persist Security Info=False"
adoSearchResults.RecordSource = "Select * From tblQuestionsAndAnswers"

Set txtDate.DataSource = adoSearchResults
txtDate.DataField = "Date"
End Sub

but I get an error message that says, "Syntax error in FROM clause" even though there was no such message when I was just setting the ConnectionString and RecordSource properties of the Adodc control in code.

Please help!!! I am BRAND NEW to using VB to work with databases and not that great with VB in general, so if you can help me, please talk to me like I'm a moron. Thanks. Any help would be greatly appreciated.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Adodc Connecting To A Website
i dont have vb on a computer with the internet but i want to know can i connect a adodc control to a database on a web site and how?

thanx

Changing ADODC Connecting String At RT
I use some ADODC's to retrieve data from a database.
The connecting string is built-in at design.

Can I change this connecting string, namely the path to the database, at run time?

Thanks!

Hervé Chain
Houston, TX

Need Help With Adodc And Textbox
I'm new at vb6 and i need help with adodc and textbox, why is that when i type in the textbox and go to the other fields the text that i input will disappear in the previous textbox? pls i need your help.

Can Use ADODC & TextBox?
I'm using VB6, ADODC properties to create a recordsource using adcmdtext(SQL) to extract out records info to be shown on textboxs when i click the ADODC next button, but nothing appear.
I have already make the textbox DataSource to point to the ADODC & the datafield to the intended field.
I also try to debug my SQL text by outputing the info to a msgbox. the output data is Ok.
What could go wrong or i miss out some steps?
Do I have to use FlexGrid to represent my info after search?

VB6 IDE Crashes From Binding Textbox To ADODC
Hi,

I am switching data controls on a project from DAO to ADO. The project worked using DAO but for various reasons my company wants the switch over to ADO. I have a group of textboxes with the DataSource set to a ADO data control at design time. The data control itself is setup at runtime in the form load. In form activate, the DataField property of the textboxes are set to the field that they should be bound to. As soon as the code with the databinding is hit, the IDE crashes and shuts down due to a memory read error. It's not that the project crashes, it's the entire IDE. I have to restart visual basic. If anyone has any suggestions I would love to hear them. If you need more information or clarification let me know. I really need to resolve this issue.

Thanks,

Doug

Autonumber Using Maskedit/textbox Using Adodc
how do you make a textbox or a maskedit box generate an autonumber. is it 'safe' to use, say intCounter +1? i have used this for the time being but i am not sure if this is the best way. is there another way?

Need To Control Access.mdb Location In Code, Not ADODC Control Properites.....Using VB6
I have a simple VB6 program which is working fine. I have a form with an ADODC control on it I call "AdoCalendar". One of the properties is the "Connectionstring". Amoung the items in the string is the location of my access .MDB file.

The Connectionstring is as follows: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\metisData TransferCSSEms Clinical DataSchedules.mdb;Persist Security Info=False

As I said, this is working fine. What I need to be able to do is set the database location in the code instead of the properties for the control. When the program is installed the path to the data will will be assigned and stored in a reg setting. It will not be know at design time.

I have tried the following code but it does not work. It tells me that it cannot find the path to the database etc.

I blank the "Connectionstring" property and put the following line in the beginning of the Form Load sub routine.

Dim DataDir

Dim DataConStrg

DataDir = "\metisData TransferCSSEms Clinical Data"

DataConStrg = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataDir & "Schedules.mdb;Persist Security Info=False"

AdoCalendar.Connectionstring = DataConStrng


'other code...

'sample line to find record...

AdoCalendar.Recordset.MoveFirst

FindString = "calName=" & "'" & LabCalTitle.Caption & "'"

AdoCalendar.Recordset.Find FindString


The Error I get when the form loads is......

AdoCalendar

[Microsoft][ODBC Driver Manager]Data Source name not found and no default driver specified


I then click "OK" and then get the following error, which after the previouse error I would expect....

Microsoft Visual Basic

Run-time error '91':

Object variable or With block variable not set

I click "Debug" and it takes me to the first use of the recordset...

AdoCalendar.Recordset.MoveFirst

So bottom line... I get NO errors when I program the connectionstring via the ADODC control properties box, but DO get errors if I try to set it via code at form load.

As I said the code works fine except for that one issue.

So, does anyone know a way, using minimal changes to existing code, for me to be able to use code to control the database location etc?

Thanks in advance,

Ralph Malph

Difference Between Data Control And Adodc Control
difference between data control and adodc control ...?

Connecting The Image List Control To The Toolbar Control
Hello
can you guys tell me how to connect the image list control to the toolbar control. In the book i am going through, it says i got to go to the toolbar Property Pages dialog box's ImageList option to assin images to each toolbar button.


but i can't seem to change the ImageList

ADODC Control
I am creating Certain textboxes at runtime..........i have used an adodc control on my form.....is it possible to save the data in these textboxes into the database with the commands
adodc.recordset.addnew
adodc.recordset.update

????

Thanx

ADO Control ( Adodc )
i am using an ado control ( adodc ) to connect to an access 2000 database. my problem is that if i move the folder where in all project and database files are stored to some other location and then execute the project, there it gives an error that database path not found. i have tried using the app.path property like this.

Private Sub Form_Load()

Adodc1.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "diarysmart.mdb " & ";Persist Security Info=False"

End Sub


however this didnt help. please help. thanks.

ADODC Control ?
Hi. I have trouble with ADODC control, when I try to do a search "Field not updatable, Bound Property Name: Value, Field name: Alergico_si" shows up, What could be the problem?

Thanks

ADODC Control
Hi all

Can you tell me if it is possible to use the ADODC control to connect to a query in a Access 2000 DB. The reason I ask is i keep getting an error about Systax error FROm Clause. Could anyone help me?

Cheers in Advance

Adodc Control
Well, i have 2 adodc controls on my app.

if i used the first one: everything is ok.
the second one: Object variable or With block variable not set.

Of course vb is wrong. You donot have to define control.

Where is the problem?

P.D.: fields on the table are ok.

Adodc Control
i using VB6

i have set the necessary things for the adodc control but i have a query. i have selected MIcrosoft OLE DB Provider for ODBC driver for connection string wheni click the build button.

the data link properties inside got a few tabs.
under the connection tab, i need to fill in the necessary details
but wat is the

"Enter initial catalog to use:" wat is tis selected for ??
do i need to select or i can leave it blank??

i have try searching but i can't find any reading material reading tis can anybody tell me wad is tis for??????

ADODC Control
Hi
In vb6 using access database I want to access record from fields of 2 tables using one ADODC.
User Interface will have 5 text boxes......
Table 1>(Address) and fields are Firstname,Lastname and Nickname
table 2>(Details)fields are Birthdate,Age,ID
Primary Key Firstname of Table Address
Foreign key ID of Table Details.

Frontend in VB6 is as follows
One ADODC control with 5 Text Boxes......
text1 should show Firstname
text2 should show Lastname
text3 should show Nickname
text4 should show Birthdate
text5 should show Age

Pluse ADD , Delete next and previous command buttons...

I tried but adodc using property window won't be able to show fields from other table. I am mapping text boxes with table fields through property window not using code........

In above example how i will get records in all 5 text boxes using one adodc control from two table.........

Thanks in Advance
Santosh

Adodc Control
hello i am using adodc control to connect to a database.in one table there is a column autonumber.i want that autonumber to be displayed in one of my text box in the form while the form loads.
so please do help me in this aspect.
with regards
ashok

Adodc Control
hi,

i am jaz learning a about using ado data control. it is very difficult for me to find the solution for my probs thats why i seek help.

my problem is when i issue a command:

adodc1.recordset.delete

- it will generate an error message saying.
"Multiple-steps operation generation errors. Check each status value"

Please help me. tnx in advance

-marexblue

ADODC Control
Questions:

is it slower if i use ADODC control in connecting to Sql server than coding it in the program?

Is connecting through a DSN slower than connecting directly to a server?

How about when i use the data environment? Will it make my program run slow?


Thanks!!!

ADODC Control
How do you set the ADODC Connection String at runtime. The reason for this is that the application will reside on different machines and the DB may reside in a different directory than I specify. The error I get always occurs when I do frmTable.show. Any help on this would be great.
Thanks,

James

Adodc Control?
When program running ,how to set adodc control's
"connect string" property ?

ADODC Control
Hi,
I want to use one form for displaying several tables.
Therefore I make one frame per table and display the corresponding fields in
the frame. I have one ADO data control and I want to switch tables
dynamically. I know this must work but when I open this form the message
"Unable to bind to field or datamember : ..." appears on the screen.
This was working with a normal data control before. What do I have to do
to make it work again ??

Adodc The Same As Data Control?
hello,

I've noticed that a lot of people are having trouble with the data object DatabaseName property etc. I am using Access 2000 and I was wondering if the adodc connection works the same as the other data control but is more suitable when using access 2000...because I'm having the same problem

Can someone explain if I can use the adodc in the same way...

Also when I try and use app.path it doesn't recognise it???

thanks

Data Or Adodc Control?
Is it Better to use a Data Control or a Adodc Control for a database Access Program?

ADODC Control Problems
Hello Guys. I have a problem with my program because adodc control does not seem to work when I run the program. The problem is, it does not return a query while if I declare a recordset variable. the query works. Can you guys help me please. Thank you ver much!

btw I'm using mr. loquin's datagrid print module. I tried a remedy like declaring an adodb.connection
and adodb.recordset variable through option explicit and executing query in form load and it worked fine. It displays the records but when I changed the recordset variable in the:
Code:
Print_Data_Grid DataGrid1, _
Form4.recSet3.Recordset, _ 'I changed the recSet3 to the recordset I declared in my option explicit
print_Port, _
Me.chkGrid.Value = vbChecked, _
Me.chkHeader.Value = vbChecked, _
Me.chkCaption.Value = vbChecked, _
CDbl(Me.txtMarginTop.Text), _
CDbl(Me.txtMarginBottom.Text), _
CDbl(Me.txtMarginLeft.Text), _
CDbl(Me.txtMarginRight.Text)
and it generated an error: "method or data mamber not found" I'm completely lost in this, could you guys help me out. Thank you so much in advance.

Data Control And ADODC
i was just wonderin wat are the differents between data control and adodc..i know both can be used to interact with the database..i dont seem to see any differences between these two database object

thankx in advance

Is The ADODC Control A Bit Flaky?
Using ADODC 6 (SP4) ODBC
DataSource = DSN
DSN is a SQL Server Database
Command Type = Table

I can bind a text box and runs properly

But if i change the name of the ADOCD control - any referece to the New ADODC control fails. (invalid reference error)

----------------

Just sorted it out.

Each datacontrol must have at lease one control bound to initialize properly.

Error Using Adodc Control
Hi all,

When i am using for the below one its working
vb Code:
Private Sub CMD_OK_Click()Dim str As String    'check for correct password    If txt_UID = "" Then            MsgBox "Invalid UserId, try again!", , "Login"            txt_UID.SetFocus    Else    If txt_pwd = "" Then           MsgBox "Invalid Password, try again!", , "Login"           txt_pwd.SetFocus        Else            str = "UID = '" & txt_UID & "' AND PWD = '" & txt_pwd & "'"            Data1.Refresh                        Data1.Recordset.FindFirst str            If Data1.Recordset.NoMatch Then                If LOGINATTEMPTS < 4 Then                    MsgBox "Invalid UserId/Password, try again!", , "Login"                    LOGINATTEMPTS = LOGINATTEMPTS + 1                    txt_UID.SetFocus                    'sendkeys home and end make the text appear as selected                    SendKeys "{Home}+{End}"                Else                    MsgBox "SORRY YOUR LOGIN ATTEMPTS HAVE FAILED", , "Login"                    Unload Me                End If            Else                                ZRIGHTS = Data1.Recordset.Fields![RIGHTS]                                ZADMIN = Data1.Recordset.Fields![ADMIN]                                ZUSER = txt_UID                                ZPWD = txt_pwd                                Unload Me                                Load frmmain                                frmmain.Show            End If         End If       End IfEnd Sub
But when im using adodc its showing error for the following code.
vb Code:
Private Sub CMD_OK_Click()Dim str As String    'check for correct password    If txt_UID = "" Then            MsgBox "Invalid UserId, try again!", , "Login"            txt_UID.SetFocus    Else    If txt_pwd = "" Then           MsgBox "Invalid Password, try again!", , "Login"           txt_pwd.SetFocus        Else             str = "Select TBL_USER.UID,TBL_USER.PWD from TBL_USER where TBL_USER.UID='" & txt_UID & "' AND TBL_USER.PWD='" & txt_pwd & "'"             Adodc1.RecordSource = str             Adodc1.Refresh                        If Adodc1.Recordset.RecordCount = 0 Then                If LOGINATTEMPTS < 4 Then                    MsgBox "Invalid UserId/Password, try again!", , "Login"                    LOGINATTEMPTS = LOGINATTEMPTS + 1                    txt_UID.SetFocus                    'sendkeys home and end make the text appear as selected                    SendKeys "{Home}+{End}"                Else                    MsgBox "SORRY YOUR LOGIN ATTEMPTS HAVE FAILED", , "Login"                    Unload Me                End If            Else                                ZRIGHTS = Adodc1.Recordset.Fields("RIGHTS")                                ZADMIN = Adodc1.Recordset.Fields("ADMIN")                                ZUSER = txt_UID                                ZPWD = txt_pwd                                Unload Me                                Load frmmain                                frmmain.Show            End If         End If       End IfEnd Sub



Kindly please help me in the above issue

Thanks and regards,
doosam

May I Open XML With ADODC Control?
I'd like to open, read and write a XML file, can i use adodc to do it?

Could i use an other control that not adodc?

Note that i never worked with XML files, i don't understand much about it...

Refreshing An ADODC Control
I need to refresh some ADODC Controls and depending on the complexity of a selection made by the user it can take up to two minutes for them all to refresh.

During the Refresh Event the form looks dead. I have added a Hourglass Mouse pointer and have brought up a "Wait" form.

I would like the user to know that something is happening (example: a progress bar) however, when I place a progress bar on the "Wait" form, it stops for the duration of the refresh event. I have also tried placing an animation of the "Wait" form, but this too stops while the refresh event is running.

Is there any way of doing something.......anything, that will let the user know that the programme has not crashed.

By the way, the ADODC is connected to MS SQL Server 2000 if that makes any difference.

Thanks

Brendan

Adodc Control Question
I'm sure this may seem to be a stupid question but I sure hope I can get an answer.

When the user of my app starts the app, 4 forms must be loaded only one visible.They switch back and forth between the forms but all stay loaded until saved. At present each form has an Adodc control that is setup identical to each of the other forms. So each makes a connection to the SQL db. Is there a way to use just one Adodc control on one form and ref it on the other forms rather than using 4 seperate ones for each form? If so how do I ref it on the other forms controls like txtbox combobox etc in the Data Source property?

Dblists Vs Adodc Control
I'm looking for a way to connect various textboxes to other columns in a record selected by a dblist For example - if textbox1.text=dblist1.text both texts are the same depending upon which is chosen by the dblist1.

The objective - hide the adodc object, select the record you want with the dblist, and havew other peieces of information (ie address,city, zip) appear in other textboxes automatically.

Thanks

Treeview With Adodc Control
Hello,

I have 3 fields in Access table and their fields are ID (pk autono) itemcode item name and description I bound them with adodc control wht i want is this fields shows in tree view and item in
parent node and name descripton in child node when i select parent and there is button to add record it should add record and display in parent node and when i select child node and press add it should add in child node and display it in tree view

Regards

Adodc Data Control
does anyone know how you can access a specific field in a specific table in an access database which is linked to an Adodc data control?

thanks, PJ

ADODC Data Control
Well here is the Deal. I am working on the following query

SELECT creditanddebit.date, creditanddebit.debit, creditanddebit.credit, creditanddebit.accountbalance FROM creditanddebit, internalaccounts WHERE creditanddebit.account= internalaccounts.accountnumber AND internalaccounts.accountdesc='Cash in Transit'


Well everything workd fine .. But I want to query it on a variable insted of the Actual field name .. 'Cash in Transit'

If i replace 'Cash in Transit' with a variable name with the same string stored in it .. It doesnt do anything

any suggestions why ?

DHTML And Adodc Control
Hi guys,
I am designing web pages using DHTML in visual basic. I would like to use access database in the back ground to store and display records on the web page.
I am having difficulty doing that.

any help would be greatly appreciated.

Thanks,
Arun

Datagrid Control With Adodc?
Hi All!, I have a problem refreshing data on the Datagrid control. I execute
sql statement directly using the ADODC control and try to make it updated
onto the Datagrid control, however, the Datagrid control is not updated with
new data... here is the flagment of codes:

sql = "update MyTable set Col1='test' where Col1='nodata'"
adoMain.Recordset.ActiveConnection.Execute sql
adoMain.Refresh
Set dgdMain.DataSource = adoMain
dgdMain.Refresh

pls tell me what I did wrong... thanks

Problem With ADODC Control?
Hi,
  In my vb6 project i am using ADODC control to fill TDBGrid, i have given reference Microsoft ActiveX Data Objects 2.5 Library and from components i have selected Microsoft ADO Data Control 6.0 (OLEDB), in my system it is working fine.

  I shifted total project into another system, in that system it is giving below error "Error during loading", even i tried create new project with ADODC also, but same error will be displaying.
 
  What is the problem? Any one please help me out.

Thanks in advance
Lalitha.C

ADODC Control Newbie
I will attach my pictures of my forms so that you can see what I'm working with. I have 2 forms that will need to be tied to a recordset. I'd like to be able to use the ADODC control to navigate through the records. Can someone please help? Thanks, Jeremy

Knowledge is the most powerful tool a person can obtain.

DeveloperKB

Run Program With Adodc Control In Other PC
I've found some problem when I try to run programs that use Adodc connection (with ODBC connection) on other PC.

I write the program on my PC (and it run great) , I make the Install Wizard using the freeware versione of DigitalWeb InstallWizard. If I run the program on my PC it's all OK, but when I try to run It on different PC I experience an error.

RunTime 30010 DataColums not found. If I set the Adodc to be visible, I see it in gray color, (On my PC I see it black and I can use it) .... it seems to be that the Adodc control cannot connect to the ODBC data source.

P.S. : The ODBC data source is the same on every PC, using then Informix Driver. I create a System DNS with the same NAME.
Please help me !!!!


Excuse for my bad english !!!



TIA

Crippa Andrea

Control ADODC Problem
Dear all,

After I uninstall and reinstall Visual Studio .NET 2003 somehow my ADODC control in my VB6 project is not working . What I meant was the control can't navigate through the database ( mdb ) on my form where I bound all the textbox to the fields of the table in my database.


The code is as simple as :

Private Sub Form_Load()


Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:VisualBasicdb1.mdb"

   Adodc1.RecordSource = "SELECT * FROM tablename"
   Adodc1.Refresh
   If Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveFirst
 
   end if

End Sub


Could you help me to solve the problem ?

Thanks

Query In Adodc Control...
I have a query which shows data from 2 tables(persons and details).
when i push the arrow buttons,i see all the records from query.

but i have also a button ,a "add new record"...and when i push this one,
i have a line like this
adodc1.recordset.addnew

also i have a button save.when i push this one,then
i insert the new values into the two tables separately.

everything it's ok until now,
but after this sequence
adodc1.refresh
adodc1.recordset.requery
adodc1.refresh
it does not show my new record inserted in the tables.WHY?
and how can i show the new added record ?

thanks.

Adodc Control Issue
hi,
I am using the adodc control, and filliing it the usual way, i.e. "select * from table"

but, when i click on the move forward, i have to click 3 times to get past the first record, is this a bug?



many thanks

DataGrid Control With Adodc
I've linked DataGrid control with Adodc.

When I change data in the DataGrid,

it automatically changes in the related source table.

How to implement that all changes will not take place until some button "Update" will be clicked?

Problem With ADODC Control
I'm having a problem when I try to use the "WillChangeRecord" event with the ADODC control.
For example, with this code (or wichever else):

private Sub ADODC_WillChangeRecord(byval adReason as ADODB.EventReasonEnum, byval cRecords as Long, adStatus as ADODB.EventStatusEnum, byval pRecordset as ADODB.Recordset)
MsgBox "Hello world"
End Sub



When I try to start the program I get the message
"Procedure declaration does not match description of event or procedure having the same name"

I'll really appreciate if someone can help me with this matter.
Thanks in advance

Juan

Without Adodc, Can We Use Datagrid Control?
Hi all,
is it possible to use a datagrid controls displaying records from a table, without using an adodc?

I have tried with adodb.connection/recordset objects, but failed.

If there is an alternate, pls let me know.

Thanks in advance.
Chandramohan J.

Datacombo & Adodc Control
Problem:
i have datacombo which displays the client name and has clientid field in the boundcolum property.
datacombo.listfield = client name
datacombo.boundcolumn = client id
datacombo.datasource = adodc1
datacombo.rowsource = adodc1

when i refresh my adodc recordset . the datacombo. boundtext shows the client name instead of the client id..

why does this happen after i do a refresh on the adodc control..?

Progress Bar With ADO Data Control (ADODC)
I have 2 forms currently, one which is a "switchboard", and the subsequent form that contains the ADO Data Control object. I've linked to a MS Access DB and I'm pulling in over 75,000 records when the form loads (data is being populated into a DataGrid). The time that it takes to load the form is about 5-10 seconds, and I'd like to put a progress bar with a display of something like "loading membership information".

I can't seem figure out a way to do this. Any ideas?

Linking The Adodc Control To Other Forms.
I have a Customer Database(Name,Num,Adress ect.) The Adodc Control is on the Main Form, but the ADD NEW Customer is on another form where the user must enter his NAME,ADRESS ect into Textboxes. How do i Link the Adodc Control that is located on the Main form to other forms,becuase i can't set the "DATESOURCE" AND "DATEFIELD" of the textboxes on other forms,becuase i must set this property to store the date inside teh Text Property of the Textbox into the Datebase.

PLEASE HELP!!! CRISUS

Cheers
=====

Copyright © 2005-08 www.BigResource.com, All rights reserved