473,508 Members | 2,130 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assigning Default Value

Hello,
I have a field called 'TestGrade'in a subform called
'frmSelectByTestSub'that I need to assign a default value to, and the
value needs to be an integer value that is exactly the same as the
value in a field called 'Grade' that is also in the subform. The name
of the main form is 'frmSelectByTest'. The 'SourceObject' of the
subform and the subform name are the same.

'Grade' in the subform can be different for each student record
selected from a dropdown list in the main form.

I've tried to use the On_Current event of the subform to evaluate the
value of 'Grade', and set the Default property of 'TestGrade' = to
that value, but that did not work.

I tried to just express [Grade] right within the 'Default Value'
property of TestGrade, but that did not work either.

As I'm thinking about it, maybe the Default Value assignment needs to
take place during the _AfterUpdate or _OnChange event of the combo box
in the main form.

What should I do to have the Default Value of 'TestGrade' reflect the
Value of 'Grade'?

Thank you for your help!

CSDunn
Nov 13 '05 #1
2 2096
Yes, use the combo's AfterUpdate event:

Private Sub Combo1_AfterUpdate
If Not IsNull(Me.Combo1) Then
Me.frmSelectByTestSub.Form.TestGrade.DefaultValue = CStr(Me.Combo1)
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"CSDunn" <cd***@valverde.edu> wrote in message
news:80**************************@posting.google.c om...
Hello,
I have a field called 'TestGrade'in a subform called
'frmSelectByTestSub'that I need to assign a default value to, and the
value needs to be an integer value that is exactly the same as the
value in a field called 'Grade' that is also in the subform. The name
of the main form is 'frmSelectByTest'. The 'SourceObject' of the
subform and the subform name are the same.

'Grade' in the subform can be different for each student record
selected from a dropdown list in the main form.

I've tried to use the On_Current event of the subform to evaluate the
value of 'Grade', and set the Default property of 'TestGrade' = to
that value, but that did not work.

I tried to just express [Grade] right within the 'Default Value'
property of TestGrade, but that did not work either.

As I'm thinking about it, maybe the Default Value assignment needs to
take place during the _AfterUpdate or _OnChange event of the combo box
in the main form.

What should I do to have the Default Value of 'TestGrade' reflect the
Value of 'Grade'?

Thank you for your help!

CSDunn

Nov 13 '05 #2
Allen,
Thank you for your help, I will try this.

CSDunn

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<40**********************@per-qv1-newsreader-01.iinet.net.au>...
Yes, use the combo's AfterUpdate event:

Private Sub Combo1_AfterUpdate
If Not IsNull(Me.Combo1) Then
Me.frmSelectByTestSub.Form.TestGrade.DefaultValue = CStr(Me.Combo1)
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"CSDunn" <cd***@valverde.edu> wrote in message
news:80**************************@posting.google.c om...
Hello,
I have a field called 'TestGrade'in a subform called
'frmSelectByTestSub'that I need to assign a default value to, and the
value needs to be an integer value that is exactly the same as the
value in a field called 'Grade' that is also in the subform. The name
of the main form is 'frmSelectByTest'. The 'SourceObject' of the
subform and the subform name are the same.

'Grade' in the subform can be different for each student record
selected from a dropdown list in the main form.

I've tried to use the On_Current event of the subform to evaluate the
value of 'Grade', and set the Default property of 'TestGrade' = to
that value, but that did not work.

I tried to just express [Grade] right within the 'Default Value'
property of TestGrade, but that did not work either.

As I'm thinking about it, maybe the Default Value assignment needs to
take place during the _AfterUpdate or _OnChange event of the combo box
in the main form.

What should I do to have the Default Value of 'TestGrade' reflect the
Value of 'Grade'?

Thank you for your help!

CSDunn

Nov 13 '05 #3

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

Similar topics

10
1800
by: Matthew Sims | last post by:
Python Newbie here. This is my first time learning object-oriented programming and trying to break out of the usual Korn/Perl/PHP style of programming. Having some difficulty understand some items....
1
2164
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not...
2
9206
by: Moshe Lupiansky via .NET 247 | last post by:
(Type your message here) 1 - How do I programmatically assign a value to a specified cell in a DataGrid? Something like DataGrid1(3,8) = "ABC" 2 - When I am going to the last row (the empty...
3
1542
by: | last post by:
T.I.A. to whomever replys... I'm new to ASP. I'm reading input from a flat-file (not a DB) using a vbscript routine to display on an ASP form so that a user can update the info, submitting the...
7
3428
by: Adrian Parker | last post by:
'function to convert null to nothing Function CheckDate(ByVal DRow As DataRow, ByVal strCol As String) As Date If DRow.Item(strCol) Is System.DBNull.Value Then Return Nothing Else Return...
2
2573
by: Bernie Hunt | last post by:
I'm having trouble assigning the reportsource value at run time. I'm running a test setup, one form with only a Crystal Viewer, called cvwMail. My report is called CustomersBasic.rpt and it draws...
2
6429
by: Lucky | last post by:
Hi guys, i was working with Enum and one Question strike, i thought it would be good idea to ask more experience guys around. the scenerio is like this : public enum check {
3
2200
by: Froefel | last post by:
Hi group I am creating a web application that uses a simple DAL as an ObjectDataSource. To retrieve data from the database, I use a DataReader object from which I then assign the various fields...
1
2024
by: balakrishnan.dinesh | last post by:
Hi frndz , I want to assgin value to <input type=file, without clicking browse button , And i know that it is readonly , But how it is possible in Firfox browsers ?.. Is there any...
0
7225
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,...
0
7383
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...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
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...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
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...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
418
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...

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.