473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

visible record

jpr
Hello,

I have a form with two controls: txt1 and txt2.

I need to add a code to the afterupdate event that adds a text in txt2
according to the data in txt1.

This is what I need:

If me.txt1 = "ok" then (txt 1 can contain any data)
Me txt2 = "Hello"
Else
If Isnull me.txt1 then
Me.txt = "" (it should not contain any record)
end if

Any idea why this is not working?
Thanks.

Mar 19 '06 #1
2 1705
jpr wrote:
Hello,

I have a form with two controls: txt1 and txt2.

I need to add a code to the afterupdate event that adds a text in txt2
according to the data in txt1.

This is what I need:

If me.txt1 = "ok" then (txt 1 can contain any data)
Me txt2 = "Hello"
Else
If Isnull me.txt1 then
Me.txt = "" (it should not contain any record)
end if

Any idea why this is not working?
Thanks.


HI jpr,

I have no idea what your subject title means but looking at your code,
you are not using the isnull() function properly. Your if statement
doesn't look correct either and it will help you see what your code is
doing if you use the tab key to indent things.

Here's how I would rewrite what you have. I assumed your txt2 is bound
to a field from a table or query and that the value of what is written
by the user in txt1 will change the value of that field for the current
record.

If me.txt1 = "ok" then '(txt 1 can contain any data)
Me txt2 = "Hello"
ElseIf Isnull (me.txt1) then
Me.txt2 = null '(it should not contain any record)
end if

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Mar 19 '06 #2
Tim Marshall wrote:
jpr wrote:
Hello,

I have a form with two controls: txt1 and txt2.

I need to add a code to the afterupdate event that adds a text in txt2
according to the data in txt1.

This is what I need:

If me.txt1 = "ok" then (txt 1 can contain any data)
Me txt2 = "Hello"
Else
If Isnull me.txt1 then
Me.txt = "" (it should not contain any record)
end if

Any idea why this is not working? Thanks.


HI jpr,

I have no idea what your subject title means but looking at your code,
you are not using the isnull() function properly. Your if statement
doesn't look correct either and it will help you see what your code is
doing if you use the tab key to indent things.

Here's how I would rewrite what you have. I assumed your txt2 is bound
to a field from a table or query and that the value of what is written
by the user in txt1 will change the value of that field for the current
record.

If me.txt1 = "ok" then '(txt 1 can contain any data)
Me txt2 = "Hello"
ElseIf Isnull (me.txt1) then
Me.txt2 = null '(it should not contain any record)
end if


And that begs the question for jpr, what happens to txt2 if txt1 isn't =
"OK" and isn't null?
Mar 19 '06 #3

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

Similar topics

18
by: Stanley J Mroczek | last post by:
I Set the EditCommandColumn to Visible=False to stop people who are not allowed to make any changes to a record. How can set it to Visible=true for some users? Please answer in VB Thanks Stan
0
by: peter_bradley | last post by:
Hi all, Not sure if this is possible, but can I change the controls of a command button on a per record bases in a subform. In my case, I would like to make a command button visible only if...
1
by: PCB | last post by:
Hi all, Not sure if this is possible, but can I change the controls of a command button on a per record bases in a subform. In my case, I would like to make a command button visible only if...
5
by: Lyn | last post by:
Hi, I have a form which contains a number of subforms in different pages of a tab control. In the detail section of each subform, I list records related to the main form record, but from...
6
by: kingphillip | last post by:
Can someone help me with some code to make a text box and lable visible only if the field in the table has something in it? Thanks
1
by: jodyblau | last post by:
I have a form that is in Continuous form. In each record there is a button next to the a date box. When the button is pushed, the calendar control is set to visible (rather than in a seperate pop...
6
by: Robert | last post by:
Quick question about the visible property on a form control. I have a label that displays a message if a certain criteria is met. By default the label is visible. I want access to compare a...
2
by: aharding | last post by:
I have fields that are set to be visible or not visible based on the value of another field. These results are displayed in a continuous subform. It works fine except that it only displays the...
1
by: Trexsuz | last post by:
I am creating a subreport with multiple records possible. I am wanting one of 2 fields (A and B) to be visible based on the inormation in another field(C Yes or No). The first record has a Yes in C...
4
by: thecheyenne | last post by:
Hi there everybody; Fresh from reading my Access VBA for Dummies, I'd like to update my database about activities on a school outing. Here's what I'd like to achieve. The school outing costs...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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...
0
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...

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.