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

Enable/Disable button

Hello everyone,

I have two different tables:Products&Variations. One of them is for product characteristics and the other is for keeping the track of any variations made on proucts.

I have a form of the table Products. I want to have a command button on this form that is disabled by default(I managed to do this).And I want this button to be enabled if the current product on the form is in the Variations table. I mean when the ProductID in the Products table appears also in the Variations table, this button should be enabled. And when I click on the button I want to see the variations made on the product.

How can I achieve this?
Jul 5 '07 #1
6 32057
kadghar
1,295 Expert 1GB
use something like

commandbutton1.enabled = true
commandbutton1.enabled = false

just chek out when you want it to happen, you can put it in the

Sub TableA_Change()

or when you load the form, or when your table getfocus,

Good luck
Jul 5 '07 #2
I know to use

commandbutton1.enabled = true
commandbutton1.enabled = false

My main problem: how can I get the ProductIDs which appears in the Variations table?

I need to search ProductID of the current record which appears on the "Products form" in the Variations table. If the search results with no value, my button should be disabled. And when I move on to the next record, this record should be searched in Variations table and button should be enabled or disabled accordingly.
Jul 5 '07 #3
Killer42
8,435 Expert 8TB
What version of VB is this?
Jul 6 '07 #4
I am using MS Access 2003
Visual Basic 6.3

Do you have any ideas?
Jul 6 '07 #5
Got it!

Private Sub Form_Current()
Set dbs = CurrentDb()
Dim rstVariation As Recordset
Set rstVariation = dbs.OpenRecordset("Variation")

If DCount("*", "Is_there_any_variation_Query") = 0 Then Command56.Enabled = False Else Command56.Enabled = True

dbs.Close

End Sub


Private Sub Command56_Click()
DoCmd.OpenForm "VariationForm", , , "Item_Code = [Forms]![IN LINE PRODUCTS-Istanbul site-2]![ProductID]"

End Sub
Jul 6 '07 #6
Killer42
8,435 Expert 8TB
Glad to see you got it working. :)

Sorry, I haven't had a chance to get back to you until now.
Jul 9 '07 #7

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

Similar topics

0
by: Big John | last post by:
I have not been able to successfully code a toggle button to enable /disable a record filter on a form.... I have been able to put seperate a button that will enable a record filter but cannot get...
1
by: Suni | last post by:
Hi everybody, But what I am trying to do is like, there are 2 forms, and if I click on the button in form1, it'll open up form2 and disable the button in form1. Then when I click on the button in...
6
by: M O J O | last post by:
Hi, I have a webform with a textbox and a button. When the textbox is empty (=""), I want the button to be disabled. When the user enters text in the textbox, the button must be enabled. Is...
2
by: bartlomiej.szafraniec | last post by:
Hi! I'm trying to implement custom button. But I don't want to extend Button class. I want to extend Control class. I want to implement Enable disable functionality. But unfortunatly when...
0
by: ArmyGeek | last post by:
Hey Guys, Im trying to figure out how to Disable a Button after a user clicks it, then Enable the Button if the user emptys a Text Box where the user can input information. I also want to...
2
by: ArmyGeek | last post by:
Hey Guys, Im trying to figure out how to Disable a Button after a user clicks it, then Enable the Button if the user emptys a Text Box where the user can input information. I also want to...
5
by: zonar00 | last post by:
Im using two forms. On form 1 i decides to open the specific form(form 2) i disables the button which is present in form 1 by changing its property to btn.Enabled=false; When i open the second...
2
by: maheshprof | last post by:
hi , how to enable a button when i enter a text in a textbox.and also it should be disabled initially after user types a text in the textbox it should enable
2
by: jbaptist | last post by:
I have 2 buttons on the form, Button A and button B. I want to enable button A from 6am till 6pm from Monday to Friday and to disable button B during 6am until 6pm. And I want to disable button...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.