473,378 Members | 1,084 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,378 software developers and data experts.

Disabled command button doesnt work after saving the record in a form

Hi,
I have a form based on query.
I have 2 portions to enter the data. Normally requires only one portion so its cool. I created Next button in 1st portion to go to 2nd portion. All the fields and command buttons are invisible in 2nd portion but get visible when i press next button at first portion.
Like:
I enter data in 1st portion...press Next
all the fields and buttons of 2nd portion become visible. I enter data and press end.
Press save button and in save button i am making 2nd portion invisible and Next button of 1st portion revisible.
But it runs only first time. 2nd time Next button of 2nd portion keep disabled
The code I used:
[For field: Me.field.Invisible=True/False
For Command btn: Me.Command.Enabled=False/True
and Me.Command.Invisible=False/True]
Please help me coz it doesn't work after pressing save button.

Thanks in advance
Oct 22 '14 #1
8 1508
Seth Schrock
2,965 Expert 2GB
Please copy and paste your code (using the [CODE/] button) exactly as it is in your project. It is impossible to see what is wrong with what you have posted. For example, above you are using the "invisible" property of the controls. There is no such thing. It is called the "visible" property that you set to true or false. If you really did have
Expand|Select|Wrap|Line Numbers
  1. Me.control_name.Invisible = True
then your program wouldn't even run the first time. You would get an error. So we need to see exactly have you have.

By the way, you don't need to make the button both disabled and invisible/enabled and visible. Just make it visible/invisible and that will control the user's ability to click on it.
Oct 22 '14 #2
Sorry for being not so clear.
Please check the following:

First Next Button:

Expand|Select|Wrap|Line Numbers
  1. Me.Command208.Enabled = True
  2. Me.Command147.Enabled = False
  3. Me.Consignee_ID_2.Visible = True
Save Button:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acCmdSave
  2. DoCmd.GoToRecord , , acNewRec
  3.  
  4. Me.Command208.Enabled = False
  5. Me.Command147.Enabled = True
  6. Me.Consignee_ID_2.Visible = False
  7.  
Command 147 = 1st Next button
Command 208 = 2nd Next button
Oct 22 '14 #3
The fields of 2nd portion and command buttons have been set visible=no
Oct 22 '14 #4
Seth Schrock
2,965 Expert 2GB
Where has the fields of 2nd portion and command buttons been set to visible = No? In the form properties?
Oct 22 '14 #5
they are set visible = no individually in their own properties.
Oct 22 '14 #6
Seth Schrock
2,965 Expert 2GB
You mention both a 2nd Next button and a Save button. Are they the same thing? Based on the code provided, everything looks like it should work, which makes me think that there is some other code that is affecting it.
Oct 22 '14 #7
ye they both next button are same things. If i change 2nd Next button to End button with same code...problem is still there i.e. they do not work after pressing save button
Oct 22 '14 #8
twinnyfo
3,653 Expert Mod 2GB
irslan,

On this forum, we also like to encourage our posters to learn and understand basic principles about database design.

Your code reminds me how important it is to have viable and meaningful naming conventions for your controls. Although your code will eventually work once we identify the problem with your code, it is a standard practice to identify your controls so that others can identify what they are based on the naming convention.

For example, instead of

Expand|Select|Wrap|Line Numbers
  1. Command147
  2. Command208
for your command buttons, perhaps:

Expand|Select|Wrap|Line Numbers
  1. cmdNext
  2. cmdSave
That allows others (e.g. "us") to quickly identify the type of control ("cmd" = Command Button) and what that control is used for ("Save" must mean that this command button saves something).

When we are only talking about two controls, it's easy to keep track of, but once you get into complex projects and forms, the small amount of extra time spent utilizing a good naming convention can save countless hours of headaches.

As I said, you code will work with just about whatever name you give your controls (aside from reserved words/functions)--we still have to help you figure your problem out--but, it is best to think about even the smallest aspects of your project design.
Oct 22 '14 #9

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

Similar topics

3
emandel
by: emandel | last post by:
I am an armature access programmer trying my best to design my own database so your patience and detailed instructions is much appreciated. Here is my question: How do I get a command button (on...
1
by: cbwright | last post by:
Using Access 2000 with VBA within an Access project. I have a form "Purchase Order" which is used to either duplicate an existing PO or create a new PO. I need to determine within the forms...
3
by: pd | last post by:
guys, in my web app, i have a simple download button and a href which points to a file on my server, when the user clicks on the button or the link, the file should simply be downloaded to the...
2
by: ijyoung | last post by:
Am trying to customise automation in Access 2007/Outlook. Using MS template which works ok. However, I have the form set up as a subform an embedded in the main form Although the form works fine in...
10
by: orajat | last post by:
hi, how do i setup a command button on a page form that when clicked, saves system time in a particular field of a table ?
4
by: Ezzz | last post by:
I have customised a form to display my own error messages using:- Private Sub Form_Error(DataErr As Integer, Response As Integer) ' If an error occurs because of duplicate data in a required...
3
by: extrym | last post by:
I have 2 forms, "Staff" and "Security" (without the ""'s). The Staff form has the following fields: staff_ID staff_name staff_number staff_DOB priority The Security form contains the...
2
by: David Anderson | last post by:
I recently began working with Access 2007, but I do have a limited experience with prior versions. I have a form with a button whose visibility I would like to make conditional on the Month value...
1
by: kelhisu77 | last post by:
In ACCESS 2007 I have 2 tables that are in a 1-to-many relationship, and the Primary Key for Table A is in both Tables. I have a form with data from Table A and a command button that opens up...
3
by: moonrb | last post by:
Hi, i am making A database. In this db there are many form with command buttons. Each command button executes many queries. These command buttons will not work properly if any field of the form...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.