473,748 Members | 4,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot Set Bound TextBox Value

Hello,
I have an MS Access 2003 Project form in which I need to set the value
of a textbox named 'TestGrade' to the value present after the update
of a combo box currently named 'Combo6'. The data source for the
project is a SQL Server 2000 database.

I have the following code written for the 'After Update' event of
'Combo6'

Private Sub Combo6_AfterUpd ate()
If IsNull(Me.TestG rade) Then
DoCmd.GoToContr ol ("TestGrade" )
Me.TestGrade.Va lue = "Exec dbo.MMFindStude ntGrade_sp" & Me.Combo6
End If
End Sub

The 'MMFindStudentG rade_sp' is designed to take a StudentID (Permnum)
parameter, and return the grade level of the student. The bound field
'TestGrade' is of type 'smallint'. The bound column of 'Combo6' is the
studentID. The combo box is supposed to pass the studentID value to
the procedure, and 'TestGrade' is then supposed to be populated with
the student's grade level that the procedure returns.

When I tried to test this the first time, I got an error message back
stating that the control I was trying to populate had to have the
focus. After adding the 'DoCmd.GoToCont ol' statement, I tested combo6
again, and got RunTime error 2113 'The value you entered is not valid
for this control'.

The following is the code for the procedure:
*************** *************
alter Procedure MMFindStudentGr ade_sp
@Permnum varchar(12)
AS
Select Cast(Right(Grad e,1)as smallint)
From Student_Data_Ma in
Where
Permnum=@Permnu m

exec MMFindStudentGr ade_sp
@Permnum = 602
*************** ***********

I have done this type of value assignment between combo boxes, but not
from a combo box to a text box before.

How can I modify this code so that the bound text box called
'TestGrade' can be populated with the results of
'MMFindStudentG rade_sp' after Combo6 updates?

Thank you for your help!

CSDunn
Nov 13 '05 #1
2 3871
Am Mon, 12 Jul 2004 17:08:07 -0700 schrieb CSDunn:
Hello,
I have an MS Access 2003 Project form in which I need to set the value
of a textbox named 'TestGrade' to the value present after the update
of a combo box currently named 'Combo6'. The data source for the
project is a SQL Server 2000 database.

I have the following code written for the 'After Update' event of
'Combo6'

Private Sub Combo6_AfterUpd ate()
If IsNull(Me.TestG rade) Then
DoCmd.GoToContr ol ("TestGrade" )
Me.TestGrade.Va lue = "Exec dbo.MMFindStude ntGrade_sp" & Me.Combo6
End If
End Sub

The 'MMFindStudentG rade_sp' is designed to take a StudentID (Permnum)
parameter, and return the grade level of the student. The bound field
'TestGrade' is of type 'smallint'. The bound column of 'Combo6' is the
studentID. The combo box is supposed to pass the studentID value to
the procedure, and 'TestGrade' is then supposed to be populated with
the student's grade level that the procedure returns.

When I tried to test this the first time, I got an error message back
stating that the control I was trying to populate had to have the
focus. After adding the 'DoCmd.GoToCont ol' statement, I tested combo6
again, and got RunTime error 2113 'The value you entered is not valid
for this control'.

The following is the code for the procedure:
*************** *************
alter Procedure MMFindStudentGr ade_sp
@Permnum varchar(12)
AS
Select Cast(Right(Grad e,1)as smallint)
From Student_Data_Ma in
Where
Permnum=@Permnu m

exec MMFindStudentGr ade_sp
@Permnum = 602
*************** ***********

I have done this type of value assignment between combo boxes, but not
from a combo box to a text box before.

How can I modify this code so that the bound text box called
'TestGrade' can be populated with the results of
'MMFindStudentG rade_sp' after Combo6 updates?

Thank you for your help!

CSDunn


Hello,

it's not so easy.

You have to use the Command-Object and retrieve the grade Value from
this object. Access has some help on the Command-Object.

HTH
Karpi
<fluctuat nec mergitur>
Nov 13 '05 #2
Yes, that's what I found out! I was able to find a solution on an Access VBA site.

Thank you for following up!

Chris Dunn

Hans-Joerg Karpenstein <hj***********@ web.de> wrote in message news:<pa******* *************** ******@web.de>. ..
Am Mon, 12 Jul 2004 17:08:07 -0700 schrieb CSDunn:
Hello,
I have an MS Access 2003 Project form in which I need to set the value
of a textbox named 'TestGrade' to the value present after the update
of a combo box currently named 'Combo6'. The data source for the
project is a SQL Server 2000 database.

I have the following code written for the 'After Update' event of
'Combo6'

Private Sub Combo6_AfterUpd ate()
If IsNull(Me.TestG rade) Then
DoCmd.GoToContr ol ("TestGrade" )
Me.TestGrade.Va lue = "Exec dbo.MMFindStude ntGrade_sp" & Me.Combo6
End If
End Sub

The 'MMFindStudentG rade_sp' is designed to take a StudentID (Permnum)
parameter, and return the grade level of the student. The bound field
'TestGrade' is of type 'smallint'. The bound column of 'Combo6' is the
studentID. The combo box is supposed to pass the studentID value to
the procedure, and 'TestGrade' is then supposed to be populated with
the student's grade level that the procedure returns.

When I tried to test this the first time, I got an error message back
stating that the control I was trying to populate had to have the
focus. After adding the 'DoCmd.GoToCont ol' statement, I tested combo6
again, and got RunTime error 2113 'The value you entered is not valid
for this control'.

The following is the code for the procedure:
*************** *************
alter Procedure MMFindStudentGr ade_sp
@Permnum varchar(12)
AS
Select Cast(Right(Grad e,1)as smallint)
From Student_Data_Ma in
Where
Permnum=@Permnu m

exec MMFindStudentGr ade_sp
@Permnum = 602
*************** ***********

I have done this type of value assignment between combo boxes, but not
from a combo box to a text box before.

How can I modify this code so that the bound text box called
'TestGrade' can be populated with the results of
'MMFindStudentG rade_sp' after Combo6 updates?

Thank you for your help!

CSDunn


Hello,

it's not so easy.

You have to use the Command-Object and retrieve the grade Value from
this object. Access has some help on the Command-Object.

HTH
Karpi
<fluctuat nec mergitur>

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1582
by: BBM | last post by:
Hi, I'm having trouble getting control data binding to work. As I understand it, the simplest form of databinding requires three things: 1) A control (say a textbox) on a form or user control, 2) A field or object.member to which you want to bind, 3) A "Binding" object that connects the variable to a property of the control ("Text" for example).
6
2416
by: Frank | last post by:
Hopefully this is the correct group for this message. My previous post to (I assume) a non-.net group was not welcomed. I have a form with 7 text boxes that are all bound to fields of a dataset. The form also contains a datagrid also bound to the same dataset. I have a button on the form to update the data to the source.
1
9412
by: Rich | last post by:
Hello, I have some datefields in a dataset (ds1). I bind some textbox controls on a windows form to these date fields in ds1, but I only want to see 01/01/2004 instead of 1/1/2004 8:00:00 AM. In a DateTimePicker control I can set a custom format("MM/dd/yyyy"). So when I iterate through ds1 with currency manager (cma) I see the correct date format in a DateTimePicker control. Is it possible to set a custom date format like that for...
7
4229
by: Andrew McKendrick | last post by:
Hi, I've noticed a bug in VB.NET (latest .NET Framework)... - I have a TabControl on a form with several tabs. - Each tab contains text boxes that are bound to fields in a data source (DataBindings). - When I display a record and then try to access the .Text property of one of the text boxes on any tab except the current tab, the result is an Empty string.
1
1627
by: Michael via .NET 247 | last post by:
I have a datagrid with the columns defined in the aspx <columns> <asp:TemplateColumn HeaderText="Hours" ItemStyle-Width="1%"ItemStyle-HorizontalAlign="Center"> <ItemTemplate> <asp:TextBox Columns="2" EnableViewState="False" ID="Hours"Runat="server"></asp:TextBox> </ItemTemplate> </asp:TemplateColumn> ... </columns>
0
3009
by: colleen1980 | last post by:
Hi: There are two textboxs in my main form. One is bound and another is unbound. There is no entry in the unbound textbox as values come into automatically after entering some information in the subform. My question is how to i pass values from unbound textbox to bound textbox every time when the value change in unbound textbox i need to change the value in the bound textbox. When the form load there is already value in the bound textbox...
4
2002
by: Matt Fondoble | last post by:
I have a form with multiple textboxes, checkboxes and comboboxes bound to a dataset in VB 2003. I was forced to change the database structure of a field from bigint to char. After changing the database and all associated stored procedures, my textbox bound to the newly changed field will not populate and I receive the error below. Unhandled Exception: System.Data.SqlClient.SqlException: Error converting data type varchar to bigint ...
2
2152
by: cjard | last post by:
Suppose: A TextBox is bound to a BindingSource, which is bound to a DataTable A BindingNavigator is used to alter the current row being looked at by the BindingSource (i.e. Nav's NEXT button is pressed. BS.Position changes from 2 to 3, Textbox was showing APPLE, now shows ORANGE) Does the textbox receive any notification that this occurred? If so, what?
2
4034
by: KC-Mass | last post by:
I have a form that is used to ID and then load Excel files into Access. I use labels on the form to record which file was last loaded. That was accomplished with a simple lblFileLoaded = strFullFileName. The label would show the file name and when the form was closed and then opened it would still show the name of the last file loaded. That preserves an important piece of information. Suddenly the form has stopped doing that. When you...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.