473,398 Members | 2,125 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,398 software developers and data experts.

Strange error occur when one command playing several roles

I am designing a 2000 format database in 2003.

In a form, I use two buttons to serve several circustances:
1. Button1.caption="New record" Button2.Caption="Edit record"
After click Button1, data entry appears. Button captions change into:
2. Button1.Caption="Save Record" Button2.Caption="Cancel"
If I select Button2 in first occassion to edit the current record, Button captions change into:
3. Button1.Caption="Save Changes" Button2.Caption="Undo changes"

In this way, every button has 3 functionalities to execute. To choose the right function, I judge by button captions.
--------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click()
  2.  
  3. Select Case Me.Button1.Caption
  4. Case "New Record"
  5. ....
  6. Case "Save Record"
  7. ....
  8. Case "Save Changes"
  9. ...
  10. End Select
  11. End Sub
-----------------------------------------------

It works on my pc. But it does not once the DB is put onto server and accessed from another PC (Access 2003). It seems the problem is caused by selecting its caption.

I am really confused. Could someone help me with this?
Mar 22 '07 #1
4 1320
NeoPa
32,556 Expert Mod 16PB
I can't help much I'm afraid, as I use Access 2K at work and I've never come across this problem before. Using technical parlance this is a 'BITCH'.
To get around it, if you're not currently using the .Tag property of the CommandButton, set that to match the .Caption and then use that in your Select Case code.
Check compilation of your code though as I'd be surprised if you could change the .Caption but were unable to read it :s
Mar 23 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
What error message are you getting Stephanie?
Mar 25 '07 #3
Thank you for your help guys!

I got around the problem by adding a form-wise variable to store the "add new" or "edit" status. It is so weird. I think VBA doesn't like any spaces or "-" in the caption; otherwise it will work.
Apr 19 '07 #4
NeoPa
32,556 Expert Mod 16PB
As long as you're sorted Stephanie.
I won't pretend to understand what caused your problems.
Apr 19 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
4
by: Tjerk Wolterink | last post by:
I've xml code like this: roles.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <roles xmlns="http://www.wolterinkwebdesign.com/xml/roles"> <!-- ! The admin role. ! And admin should have...
5
by: Rob Ristroph | last post by:
Hi, It's pretty unhelpful to post "I have a huge piece of code that crashes in strange places, what's the problem?" but that's basically my problem and I really am at my wit's end. The piece...
24
by: LineVoltageHalogen | last post by:
Greetings All, I was hoping that someone out there has run into this issue before and can shed some light on it for me. I have a stored procedure that essentially does a mini ETL from a source...
25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
10
by: Shals | last post by:
Hi I'm using Command DoCmd.OpenView "dbo.vFDXQryBldgEdit3",acViewNormal,acEdit to open a view vFDXQryBldgEdit3 (written in SQL Server) in the Edit mode. This view is created on single table....
5
by: Jeff | last post by:
Okay, I'm still new to vb.net 2005 - throught this was a hardware problem, but now I don't know. (I'm having some problem with my newgroup provider, so hopefully this will go through) This...
4
by: kj | last post by:
I'm running into a strange seg fault with the module cjson. The strange part is that it does not occur when I run the code under Emacs' Pydb. Here's an example: import sys, cjson d1 =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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
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,...

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.