Using Or Not Using Bound Control For Lookup Table
Sould i use bound controls to connect to a DB? I realize it if faster to code but is if efficient use of DB resources? Does the connection stay open the whole time the DataCombo is active?
I found this code in a FAQ Code: Private Sub Form_Load() Dim oRS as New ADODB.Recordset Dim strSQL as String
strSQL = "SELECT PubID, Name FROM Publishers" oRS.Open strSQL, goConn, adOpenForwardOnly Set DataCombo1.RowSource = oRS DataCombo1.ListField = oRS.Fields("Name").Name DataCombo1.BoundColumn = oRS.Fields("PubID").Name End Sub
The goConn is the connection to the database via a global connection which is one way of having a connection to a database which is shown in the attached Demo
Basically what is the benefit of this line of code: DataCombo1.BoundColumn = oRS.Fields("PubID").Name
Here is my issue. I would like to be able to pull all the Departments from a DB table and display them. When the user selects a department the department ID is stored in Employee DB when user registers. This will allow me to query results by department.
What i was planning to try is using a regular combo box, reading the Departments from the DB and placing them in the combo box. Which is better? Teh bound control or the latter? Thanks!
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Table Lookup
Hi
I'm having trouble with a table lookup. I have a relationship between 2 tables, boats and classe. When I add a new boat I want to select the class it belongs to. I'm using a datacombo but can't get it to display the class names.
If I use the ADO Control it works but not when I try to code it:
Private Sub DataCombo1_Click(Area As Integer)
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:WinsysVisual BasicMy ProgramsVB6 Sailing Boat ProjectBoat Race.mdb;"
Dim rsClass As ADODB.Recordset
Set rsClass = New ADODB.Recordset
rsClass.Open "Select classid,classname from classes", db, adOpenStatic, adLockOptimistic
With DataCombo1
Set .DataSource = adoPrimaryRS
Set .RowSource = rsTest
.ListField = ClassName
.DataField = classid
.BoundColumn = classid
End With
Can somebody tell me how to get this working.
Cheers
Lookup Table In VB
I am making a program in VB with the following objects:
- 1 text box
- 1 command button
- 3 labels
- label 1 = Error Number
- label 2 = Error Description
- label 3 = Error fixes
Ok, what i want is for the user to type a number i.e. 680 and then press the command button and my program will look through the database(system1.mdb) which has three fields:
- Error Number
- Error Description
- Error fixes
I would like the three fields too be displayed in the appropriate labels.
Any ideas?
Carl
How To Use Lookup Table?
I have 2 table.In one of them is a field with a code number.In another is same fields and another is names that related by them.
If I want show one of that names in a text box ,how can I do it?
I have two Adodc that connect to this tables.
Lookup Table Speed
I had always thought that lookup tables were quicker than the built in Trig functions, and this seems to be bourne out be various games programming websites. However, I can not get my implementation to even the same speed as the builtin VB trig functions.
Here is my lookup code:
Code:
Public Function QSin(ByVal Angle As Single) As Single
If bTrigTablesBuilt Then
QSin = tblSin((Angle * TrigAccuracy) 1)
End If
End Function
Angle is in degrees and TrigAccuracy specifies the number of decimal places to use (the value itself is a multiplier to bring the angle value up to number number to index the array).
Can anyone see a way to improve the speed of this?
Makin A Lookup Table
Hi, i'm tryin to make something that is like in help files, the index part, where u type a letter it narrows down. How would I do that w/ a dblist and a textbox?
Lookup Field In Table
Hi,
I'm creating a database aplication in Access and I'm thinking of using a table to hold some database parameters in it.
Things such as directory path for files to be uploaded, which Dial-Up Networking Connection to use when dialing up etc.
My question is how, in code, do I lookup the field and assign it to a variable?
e.g.
Code:
strPhoneNumber = Value from Phone Number field
Hope I've made myself clear?
Regards
1-Table Lookup 2-Backing Up
I have two questions.
1 - My code finds a string in a table's first column and brings matching values from the other columns of the matched record. Now my database grows bigger and I need to group specific info on separate tables. I will change my code so that the code would first search the table name (which would be selected in a combobox by the user), then search its first column for an entry matching a textbox again filled in by the user.
Can you advise me how a table is searched ?
2 - My application depends on some databases placed in the application's paths. The app regularly compacts, repairs and backs up the databases. If the original is corrupted or accidentally deleted by the user then this created back up is brought back in to the app path and used thereafter. Where do you recommend me to keep these backups ? In Windows directory, Temp directory ? Where ?
Thank you
Lookup An Access Table
Hi,
I am using a DAO Connection from VB to an Access database. I wanted to know if there was an easy way to lookup a single value - in the same kind of way that Dlookup works in Access
e.g.
value = DLookup("[COSTING_COMPONENT_ID]", "COSTING_COMPONENTS_LKP_TBL", "COMPONENT_TYPE='Salaried Positions'")
instead of having to write a an SQL string and open the recordset etc.
Cheers and thanks
VW...
SQL Question For Lookup Table.
Say for instance you have the following:
table:
create dbo.tbl_Users_Provinces
[ProvinceID] INT NOT NULL,
[Province] NVARCHAR(50) NOT NULL,
CONSTRAINT PK_tbl_Users_ProvinceID PRIMARY KEY CLUSTERED ( ProvinceID)
)
This table will be a lookup table and will contain all the values
1 QUEBEC
.
.
.
N ONTARIO
Now, given the following user's table:
CREATE TABLE dbo.tbl_Users]
(
[UserID] [int] IDENTITY (1, 1) NOT NULL ,
[UserName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[FirstName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[LastName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[StateProvinceCityID] [int] NOT NULL ,
CONSTRAINT [PK_tbl_Users] PRIMARY KEY NONCLUSTERED
(
[UserID]
) ON [PRIMARY] ,
CONSTRAINT [FK_tbl_Users_tbl_Users_Provinces] FOREIGN KEY
(
[ProvinceID]
) REFERENCES [tbl_Users_Provinces] (
[ProvinceID]
)
) ON [PRIMARY]
GO
Now Say I want to do a select statement and on userid or FirstName. and retrieve all the values including the province name and not a the index value for that province.
How would you approach this. Now, things have change for lookup tables.
There are many possibilities. Which one is the most logical one and why? If my question is too long then just help me on the query I will analyze the reasons.
Let's share our knowledge together!!!
Matt Cupryk
514-685-0449
Alternative For A Lookup Table
good morning,
I was designing a database for a payroll system and have come up with a database fully normalized. however, I noticed that I was able to create a reasonable number of lookup tables. If i wish to remove some of them (maybe to reduce the number of size of the database) are there any alternatives? or is it way better leaving them behind?
follow up question-- Do I still need to make a look-up table for a GENDER Field (e.g., Male, Female)?
Please help me with this.
Any reply is greatly appreciated!
thanks and GOD BLESS!
---==+ Fear is what keeps us from doing things we know we can't... but we can. +==--- - zhylax
Range Value - Table Lookup
Hi, Guys.
I have range value in Ms Access Table. When I type a value in textbox, in another textbox will be dispalyed the value that has been convert to character.
Let's the table is like this:
ValMin-----ValMax-------Char
---0----------50-------------E--
--51---------60-------------D--
--61---------70-------------C--
--71---------80-------------B--
--81---------100-----------A--
When I type value in txtValue "75", the value of chararater in txtChar will be 'B'.
Here is the code :
Private Sub Form_Activate()
Dim sqlstring
sqlstring = "select Char from TblValue where Valmin >= " & txtValue.Text & " and Valmax <= " & txtValue.Text
Data2.RecordSource = sqlstring
Data2.Refresh
End Sub
Private Sub txtValue_Change()
Dim sqlstring
sqlstring = "select Char from TblValue where Valmin >= " & txtValue.Text & " and Valmax <= " & txtValue.Text
Data2.RecordSource = sqlstring
Data2.Refresh
End Sub
Thank you.
/sukarso
Create Lookup Table With DAO
I have a table named "MAIN". I want to create using code (DAO), another table with one field that will lookup (via Lookup field)its values from the "MAIN" table. So in the end I will have 2 tables, one will be "MAIN" and the other will have one column that will lookup its values from the "MAIN" table.
Code Problem {lookup Table}
ok im writing a sports day program for my school by using a excel spreadsheet. lets say im looking at the 100 m race and for every time which is achieved by a competitor he is rewarded with points.
now i can do it by writing all the possible times with the corresponding points into a spreadsheet, which would mean i would have to write alot of If - Then statements such as:
If 12 > Text1 > 11 Then
MsgBox Cell(1, 1)
End If
this would then have to be repeated for every single range of times.
Is there any way to make ranges in excel and then by using VB searching these?
such that you have a speadsheet like this:
x > 20 | 10
20 > x > 18 | 20
18 > x > 16 | 30
.
.
10 > x | 1000
is there anyway in excel to make ranges and then by VB finding these?
thank you
How To Write A Table Lookup Function In VBA?
Hi,
I want to write a VBA function that will search through a two-dimensional table until it finds an element specified by a given row index and a column index, both of which will be passed in as parameters. The row header would have 6 elements, with values (say) apple,orange,mango,pear,grape,melon. The index passed in would be "grape", for example. I then want to search this row until it finds "grape", and return the column number associated with that element, in this case 5. I would search through the column header following a similar logic (i.e. find the row in which the column index resides). If this index were 14 (say), then I could use a Range object to get the value in column 5 and column 14, and return this value from the function.
I know how to do this in the spreadsheet using worksheet functions (a combination of MATCH & OFFSET), but I'd like to do it using VBA as I think its clearer and more transparent (and I need to use it in several places). I initially tried using the worksheetfunction method to allow me to use MATCH & OFFSET, but I didn't get anywhere with it. In any case, this method is not ideal, as it isn't clear. Can anyone suggest anything?
Table Design And Lookup In Queries
Hi,
This is probably a dumb question but I have three tables, tblCustomers, tblOrders, and tblCreditCards. tblCustomers links to tblOrders by CustomerID, tblOrders to tblCreditCards by OrderID. An ori l order would have values in all three tables. Now a second order placed by a customer already has customer info and uses the same credit card. I add a new order to tblorders. Is there a way in a query using the Dlookup function to lookup the creditcard even though there are several orders for one cusomter. I tried to use orderid but this didn;t work because they original orderid is obviously different from the second. And also make the first creditcard number the default for additional orders by the same customer.
Thanks
Number Prefix Lookup Table In MDB
Hi all,
I'm trying to get my VB6 app to look up prefixes for a phone number out of
an MDB file along with an associated price etc.
For example the phone number could be 9802xxxx, and the MDB file will have
the record 9802 with an associated price.
I am used to connecting to databases via ADO, but my problem is that the MDB
file may contain prefixes from 1 to 5 chars in length and i'm not sure how
to get VB to find the best match.
I'm assuming it can be done with a very large nested IF statement, is there
a better way?
Cheers,
John
Commission Table Lookup / Calculation
Using Access 2000, I'm creating a small app that calculates commission. The commission is tiered such that commission/unit rises after a threshhold. I'm trying to determine the most efficient way to determine a commission rate without hard coding the values. (The rates and threshholds will be stored in a table which will need to be changed from time to time). I was hoping somebody could inform me of a more effiecient way than I'm doing it currently -- this way works but I've got 12 levels of rates, threshholds and hence potentially 12 levels of nested ifs.
CommissionTable
Level Threshold Rate
1 20 $50
2 30 $75
3 40 $100
dim strSQL as string
dim dblSalesUnits as double
dim Rate1, Rate2, Rate3, CommisionRate, CommisionTotal as currency
dim Level1, Level2, Level3 as single
strSQL = select * from commissiontable
'Assign appropriate values to rate and level variables from recordset info
If dblSalesUnits >= Level1 Then
If dblSalesUnits >= Level2 Then
If dblSalesUnits >= Level3 Then
CommissionRate = Rate3
End If
Else CommissionRate = Rate2
End If
Else CommissionRate = Rate1
End If
CommissionTotal = CommisionRate*SalesUnits
Thanks in advance for any help/suggestions.
Dcount On Form With Lookup Of Datepart On Second Table
ok Ive a report which gets info filled in form one table but my counts for that report are based on another table.
The table with the counts is called "ViewQsTotals"
Fields are:
QsNumber MonthRequested YearRequested RequestsYTD
06001 5 2004 3
06002 5 2004 3
06003 1 2004 2
06003 2 2004 1
Now I tried the folowing:
=DCount("[QSNumber]",[ViewQsTotals],[MonthRequested] =' & Month(GetDate()) & '' AND [YearRequested] = '" & Year(GetDate()) & "'")
so basically I need the count of the qsnumber(from a txtbox on my report)
for the current month and year from the above table
My Report is a continuous form so the qsnumber will be constantly changing
any Ideas....??
Need Help Creating A Lookup Table For Nasty Equation
I know this is a relatively simple question, but I'm a complete newbie so here goes:
I'm building a 2-D intermolecular force simulation, using a Lennard-Jones type interaction between the molecules, which is a really nasty equation.
http://polymer.bu.edu/Wasser/robert/work/img20.gif
I tried implementing it in place of my current simple spring interaction:
force = (spring constant) * (distance)
and I got all kinds of terrible errors. I think building a lookup table at the beginning of each loop might be a good way to go, but I've never done it before so I'm wondering if anyone could give me a quick & dirty description of how I should go about it. I'm thinking probably having an array with 2 columns (one being the distance, other being force) and looking up force by looking for the distance x between the 2 particles in question. The reason for building a new lookup table at the beginning of each new timestep is that I'd like to vary a couple of the variables in the equation as time progresses.
So does anyone have any experience building/using lookup tables? If you want to see what I've got so far you can check this out:
lennard_jones17.rar
I built an excel graph showing how Lennard Jones works here:
force3.xls
Number Prefix Lookup In A Really Big Sql Server Table
Hi all,
I'm trying to get my VB6 app to look up prefixes for a phone number in a sql server table with an associated price etc...
For example the phone number could be 9802xxxx, and the sql table will have
the record 9802 with an associated price.
it can be 98021 if phone number look like this 98021xxx.i must find the longuest one
I am used to connecting to databases via ADO, and this select statement in a stored procedure :
Code:
SELECT TOP 1 Prefix AS Prefix , price ,step,price_step From MyBigTable WHERE ( @numBerDestination like Prefix + '%' ) ORDER BY LEN(Prefix) DESC
'Prefix' is indexed.
my table contains about 1 million prefix ...
but my problem is that this operation takes too long (2s per operation)
Is there
a better way to do this ?
thanks
Errors While Connecting Lookup Table With Combo Box
I ma getting an invalid authorization error when linking my lookup from SQL server to combo box
the code is
Private Sub SetupADO()
Dim adoParm As ADODB.Parameter
Dim strSQLServer As String
'On Error GoTo SetupADO_Err
Set acnMarkets = New ADODB.Connection
strSQLServer = "sfdaqsql1"
With acnMarkets
.ConnectionString = "Provider=sqloledb;Data Source=sfdaqsql1;Persist Security Info=False"
.CursorLocation = adUseClient
.Open
End With
Set arsMarkets = Nothing
Set acmMarkets = New ADODB.Command
With acmMarkets
.ActiveConnection = acnMarkets
.CommandType = adCmdText
.CommandText = "SELECT market_id,market_name FROM market_lookup where market_id=?"
Set adoParm = .CreateParameter("market_id", adChar, adParamInput, 1, "x")
.Parameters.Append adoParm
End With
Set arsMarkets = Nothing
Set acmMarketsInfo = New ADODB.Command
With acmMarketsInfo
.ActiveConnection = acnMarkets
.CommandType = adCmdText
.CommandText = "SELECT market_id,market_name, market, state FROM market_lookup where market_id=?"
Set adoParm = .CreateParameter("market_id", adChar, adParamInput, 1, "x")
.Parameters.Append adoParm
End With
Exit Sub
'SetupADO_Err:
' Call ShowErrors
End Sub
Thanks
Help appreciated
Tabbed Form Vs. Subform Table Lookup
Good Morning everyone,
Just some quick clarifying questions r/t the differences between tabs and subforms.
We have a form that is pretty similar to a typical address book contact form. Most of the information on the form [frmPerson] is pulled from a cooresponding table [tblPerson]. However, some of the information for text boxes needs to be pulled from other tables [tblProfessional], [tblAgencyContacts], etc. and is dependent on the type of contact [tblDisciplineID].
We initially set up the form to use tabs to represent the different types of contacts. We are currently working within the tab Professional that uses a list box to allow the user to select the agency they want to lookup for there current contact. For example if I work for Company ABC and Company XYZ they both show up in the list box. The user then selects Company ABC, and the corresponding text boxes for that person and company should populate. The problem that we are seeing is that, it doesn't appear there is an easy way to associate the text boxes that are to be populated with a table different than the one the [frmPeron] is associated with [tblPerson]. So here are the questions...
1. Can tabs be used (easily) to lookup the information in a different table (i.e. [tblProfessional]) and populate text fields? I realize we could use combo boxes, but this seems like messy programming.
2. Should we use subforms instead of tabs? Obviously, subform will link directly to a different table. My only initial consideration here is trying to minimize the number of forms we have. I assume we could get the subform to change using a case statement that is dependendent on the [DisciplineID].
Many Thanks!
Adding An Entry Into A Lookup Table Using Ado Data Combo Box
I am using 2 ado controls, one for the main table books and another to lookup the authors name from his id .While adding a new book by a new author what can be done to first add this author into the lookup table and then accept the entry into the book table without the user seeing another form?
regards
Venu
Textboxes Bound To A Table In A Database...
Ok, I find this really weird! If I set focus to a textbox which is bound to a field in a table in a database, and push a command button to which contains the code
"Adodc1.recordset.update"
"Adodc2.recordset.update"
my fields are updated flawlessly. However, this is not how I want to do things. If I put in the code of my "Add" button
"Text1.text = X" 'X is the response to an InputBox prompt. It is a string.
"Text1.SetFocus"
"Adodc1.recordset.update"
"Adodc2.recordset.update"
this does not work! It is accomplishing the same thing as me clicking on the textbox and pushing the "Update" button as demonstrated in my first example. Can you tell me what is going on, and how I can fix it so that the user just clicks on one command button, types in a string into the input box, and have the string added to text1.text and updated in the database?
I am using Visual Basic 6.0 and am using an ADO data control (not a normal Data control).
Thanks! I appreciate the help.
ActiveX Control Design For Database Lookup
Hi all,
I am developing an ActiveX control that does customer search based on the option button I click ( e.g, search by customer name, phone number etc )
Since I need this function all over my program, I would like to build it as an activeX control.My activeX control should then fill up a MSFlexGrid with the result.
Impartant thing here is that my MSFlexGrid is not part of my activeX control, I am just trying to pass a reference ( reference to MSFlexGrid ) to my ActiveX control and trying to use it inside my activeX coding.
It seems like it does not work. I do not even see my MSFlexGrid in the property window for my ActiveX control.
your help is really appreciated.
Thank you.
Ramesh
WebBrowser Control And Document Objects Lookup Issue In VB
Hi, there
I have tried to use WebBrowser Control in VB for some automation.
The problem I have is with the Document Objects lookup.
3 syntaxassume the form name is "abc", VB string variable FormName="abc"
msgbox WebBrowser1.Document.Forms("abc").Name
msgbox WebBrowser1.Document.abc.Name
msgbox WebBrowser1.Document.Forms(FormName).Name
the first two syntac works fine. but the third one never works...
I wonder what cause this and how to fix it.
The reason why I need to use a string variable is because I won't be able know the form name before runtime, and I certainly don't want to go through all Forms() collection to compare one after another to find the right now.
Another issue is that it seems there is no way to establish VB to VB callback style sub or function, right?
thanks in advance,
edmond
Need To Put Info From Form "lookup" Fields Into Main Table
I have a request to create a series of forms in Access that provide succeeding bits of information back to a main table. Each row of the main table describes a preventive maintenance activity from request to scheduling.
The first form (InputForm) would include three lookup fields (dept, ext, pager) from tblNamesSite based on field "name". The content of the three linked fields must be included in the MainTable to be available thereafter.
The second form (ScopeForm) would look up "WorkOrderNumber" based on "PreventiveMaintIDNumber" or "Work RequestNumber" from an Oracle database. These three fields must also be populated in the table and called up on the approval forms. And so on, and so on.....
I researched this problem and found only one possible solution (aside from the obvious, it should be on SQL server) and found the update or edit/update function. Is this a viable solution? What is the proper syntax? Should I initiate a batch event or trigger from the form?
Thanks,
Imjay
Need To Put Info From Form "lookup" Fields Into Main Table
I have a request to create a series of forms in Access that provide succeeding bits of information back to a main table. Each row of the main table describes a preventive maintenance activity from request to scheduling.
The first form (InputForm) would include three lookup fields (dept, ext, pager) from tblNamesSite based on field "name". The content of the three linked fields must be included in the MainTable to be available thereafter.
The second form (ScopeForm) would look up "WorkOrderNumber" based on "PreventiveMaintIDNumber" or "Work RequestNumber" from an Oracle database. These three fields must also be populated in the table and called up on the approval forms. And so on, and so on.....
I researched this problem and found only one possible solution (aside from the obvious, it should be on SQL server) and found the update or edit/update function. Is this a viable solution? What is the proper syntax? Should I initiate a batch event or trigger from the form?
Thanks,
Imjay
Bound Control In VBA
Dear Forum,
I have stored some formulas (generated with the formula extension in MS Word) in a MS Access database. Then I have extablished a User Form in VBA and connected it to the database.
Now I like to view the formulas within a VBA form, but only cryptic letters appear in lable boxes and text boxes. Also image boxes don not work. Can anybody tell me, if there is a bound control (like in MS Access ... there it works fine) or another control with which I am able to view the formula?
Thanks for answers!
Hermann
Bound Control
I'm trying to convert VB 3 app to VB 6 but how do I create bound controls in VB 6? The VB 3 app uses a plugin called multilink to achieve its bound controls but I don't think I can use multlink in vb6. I am trying to write a program that will search the text of the forms and modules in vb 3 and change them to what I want. First I need to figure out how to make bound controls though so I have something to convert to.
Thanks.
Do I Need A Bound Control?
Just to insert information from a textbox into an access database, do i need the textbox to be data aware? I'm using ADO. If not, waht is the advantage of a bound control over jsut a control?
Ado Not Updating Bound Control
I have a vb from with a text box and an ADO data control. If I manually modify the text box value on the form, the value is updated when I call the ado.recordset.update method. However, if I programatically change value of the text control, this value isn't changed when I call the update method.
If I programtically change the text value of the textbox control and then tab through the fields on the form and then call the update method it works.
Does anyone know why this is this behaving differently when I programtically update it vs. when I manually type something in to the text box? If so, any workaround suggestions?
Thanks!
Todd
Data Bound Control
did your guys like data bound control? I personal feel it is suck when come to writing code for data manipulate like (add, edit, delete)
How you think about this?
OLE Control Bound To Access Via ADO
Hello all,
Has anyone had trouble binding an OLE control to an Access table using ADO?
I have no trouble binding other text boxes, image controls, etc, but when I
try to assign a DataSource to an OLE object, I get the following:
"No compatible data source was found for this control. Please add an
intrinsic Data Control or a Remote Data Control to the form."
Thanks in advance.
Bound Control Bug When Two SQL Fields Have Same Name
Hi,
I've got two fields in seperate SQL tables (a and b), both called trackNum.
b.trackNum is a foriegn key into a.trackNum. I've got a form with a few
bound controls on it (textboxes specifically), one of which displays the
trackNum from the query "SELECT a.*, b.* FROM a, b WHERE a.trackNum =
b.trackNum". All of the controls are displaying their data correctly except
txtTrackNum, which is always displaying the digit 1. If I change my query so
that it only selects trackNum from a everything is hunky-dory. Anyone come
across this behaviour before?
PS. I thought I could fix it by binding txtTrackNum to a.trackNum, rather
than just trackNum, but then it complains it can't find that field.
Thanks,
Rowland.
Using A Bound Image Control
I have an Access database one of whose tables has a field that holds an image (field name is "photo"). I want to display each DB record in a form using VB6 Image and other controls, bound to a recordset derived from the proper table. Using this lines:
Set ImgPhoto.DataSource = rsDetails
ImgPhoto.DataField = "Photo"
Produces the error: "Unable to bind to field or data member 'Photo'".
What is the correct code for displaying the correct image for each record?
Bound Dropdown Box Not Updating Bound Text Boxes...
Hi All,
I have an Access 97 form with bound textboxes, and a dropdown combo. The user selects a value in the dropdown to populate the textboxes.
Because there could be duplicates values in the combobox (the values are people's last names), I have made the combo into a multi-column dropdown, adding a first name and a date of birth. It works well, until there are multiple occurrances of the same last name. What happens in that case is only one record displays in the textbox no matter which of the combobox's values is chosen.
For instance, I have a bunch of "Smith" values, and when any of them are selected, the data appearing in the text boxes remains on "Richard Smith"... Furthermore, I checked a few different duplicates other than Smith, and it is inconsistent as to which record is always displayed. Sometimes it's the first in the bunch, sometimes it's the last, etc...
If this helps, here is the Row Source of the dropdown:
SELECT DISTINCTROW [Hospital].[PatLName], [Hospital].[PatFName], [Hospital].[PatDOB] FROM [Hospital] GROUP BY [Hospital].[PatLName], [Hospital].[PatFName], [Hospital].[PatDOB] ORDER BY [Hospital].[PatLName], [Hospital].[PatFName], [Hospital].[PatDOB];
Anyone out there ever run into this before?
Thanks,
RichS
Data Bound Grid Control (SP3)
I am using Visual Basic 6.0 on a Windows 2000 NT operating system. I have created a program on another pc which makes use of DBGRID32.OCX. However, when installing on new pc, I am encountring the following errors:
Line 52: Property OleObjectBlob in DBGrid1 could not be set.
Line 52: Cannot load control DBGrid1; license not found.
I have seeked Microsoft Knowledge Base and I found that I should register db grid by typing:
c:winntsystem32REGSVR32.EXE c:devpdbgrid32.ocx (In this case a message box appears stating that the file was registered.) Yet, the errors still occur.
Would be grateful if you could help me urgently.
Regards,
Renzo
Data Bound Control And SQL Server 2K
We have an Access 2000 Front End App that needs to talk to a SQL Server 2000 DB. The current app uses a lot of data bound controls. Will this be a problem when switching to a SQL DB
Is There A Grid Control Not Bound To A Database?
I'm looking for a grid control that does not need to be linked to a database. I have a text file with a bunch of records each on a separate line.I want to be able to present this data to the user in a grid format so they can edit fields. Exactly like a spreadsheet would work. I tried using OLE with Excel but it always shows the menu at the top and I can't rename the coumns. The closest thing I've found was the ListView control, but it will not let me edit SubItems as far as I know.
Data Bound To Flexgrid Control
Any one knows how to bound say, 2 differenct recordset to 2 different columns of a single flexgrid control, the following code i think of can't compile successfully
Set MSFlexGrid1.Col(1).DataSource = Adodc1
Set MSFlexGrid1.Col(2).DataSource = Adodc1
MS Data Bound Grid Control 5.0 (SP3)
I am using the Data Bound Grid Control in Unbound mode. I have 2 columns and would like to add a Name in the first column, Values (String) in the second column.
HOWEVER, when trying to populate the rows, my program stops at:
grd1.Row = 1
with error 'Application-defined or object-defined error'.
Alternatively, depending on grid properties, i get the error 'invalid row number'.
There does not seem to be a funtion to add rows.
HOW DO I ADD ROWS without this error occuring?
Once I do this I would like to be able to edit entries in the Value column only, but I think i can manage that bit ok!!
Simon
Data Bound Grid Control
Have just installed VB6 Professional Edition. I selected the complete option but don't seem to have the Microsoft Data Bound Grid Control 5.0 (SP3) as required by the Database Tutorial 3.
Could someone please tell me where I have gone wrong?
Capturing Content Of A Bound Control??
I have a textbox "txtBox1"whose datasource is Data1, and it's linked to field, "FirstName."
I have a seconed "txtBox2" who is Bound the same way but linked to field "LastName"
Last but not least a third textbox "txtBox3" not bound at all.
How do I allow this:
txtBox3.Text = txtBox1.text & " " & txtBox2.text
A bound textbox dosen't seem to have an accessable .Text property???
THANX.
I really appreciate all the help that all of you have given me in the past, and those yet to come.
Datafld Bound Control Problem
Hi there
I have a table on my asp page that is bound to SQL Server.
The table is like this
Code:
<tbody>
<tr>
<td><div id="column1" datafld="EmployeeID" </div></td>
<td><div id="column2" datafld="LastName" </div></td>
<td><div id="column3" datafld="FirstName" </div></td>
<td><div id="column4" datafld="LastModifiedDate" </div></td>
</tr>
</tbody>
When I return my data set from SQL Server (the SQL I issue is, obviously,
SELECT EmployeeID, LastName, FirstName, LastModifiedDate from tblEmployees
Unfortunately when I display the table, the fourth column gives me something like
2006-04-26 13:58:14.857000000
and ALL that I want is just the date component.
So my question is, is there something I can do in my ASP page that would trim the datafld to say the first 10 characters (yyyy-mm-dd takes up 10 characters)? Or must I add one more returning column in my SQL? I don't like changing the SQL just so that I can display something properly... I wish it were something I could fix on the asp client side.
Many thanks.
CalgaryChinese
Checkbox In A Bound Datagrid Control
hi !
I have been trying to get a checkbox to show up in the @#@!# datagrid control but have been unsuccessful so far. So after a whole day of researching the net i am posting this here. Please help ...
I have a datagrid control on a form ...in the form load event i have the following code. Everthing i have read so far tells me that it should work but it doesn't. Instead of the checkbox, it is still showing the values 0 and 1 for the column.
Dim rs As Recordset
Dim myFmt As StdDataFormat
'****************creating a recordset on the fly
Set rs = New Recordset
rs.Fields.Append "field1", adBSTR
rs.Fields.Append "field2", adBoolean
rs.Open
rs.AddNew
rs.Fields(0).Value = "aaa"
rs.Fields(1).Value = False
rs.Update
rs.AddNew
rs.Fields(0).Value = "bbb"
rs.Fields(1).Value = True
rs.Update
'**************end creating recordset
'**********creating the format object
Set myFmt = New StdDataFormat
myFmt.FalseValue = False
myFmt.TrueValue = True
myFmt.Type = fmtCheckbox
'********** end creating format object
Set Me.DataGrid1.DataSource = rs '***binding recordset
Set Me.DataGrid1.Columns(1).DataFormat = myFmt 'applying format
Using ADO Bound Control W/VB6 And Access DB. Stumped!
Visual Basic 6, ADO Bound Control, Database – Access 2000
I have an Invoice form that is bound to an ADO control. The ADO control is associated with several Invoice text boxes. The form also contains customer text boxes for display purposes only. I use a select statement to select the Invoice (parent) data and a join to get the Customer (child) data for the Invoice form. The common key is CustomerNo. When I click the [Get Customer] button on the Invoice form, the Customer form is launched and I select a customer from the customer form. When I return back to the Invoice form, the customer data is correctly displayed along with the CustomerNo. When I click the ADO control on the Invoice form to go to the next record (which initiates an update to the invoice table), I get a message stating that a field cannot be updated. The problem is the CustomerNo cannot be updated to the Invoice table. I tried just typing in a CustomerNo on the invoice and clicking the ADO control to move to the next record and it works. I believe that the Invoice ADO control loses it pointer when I launch the Customer form. How do I get the ADO control work properly in this case?
|