Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS ACCESS






SuperbHosting.net & Arvixe.com have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for BigResource.com.







Difference Between A Command Button And A 'label' Button


Hi, I have got a small problem and maybe someone could advise me.
I am creating a customised command button from a label button. The new button works fine but I can't apply the 'requery' function to it, if i do an error occures and i am being prompt to save the data first???? :confused: :


Private Sub Labelsearch_Click()
Me!itemquery.Requery
End Sub

Private Sub Labelsearch_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Labelsearch.SpecialEffect = 2
Me.Labelsearch.BackColor = 255
Me.Labelsearch.ForeColor = 10092543
Me.Labelsearch.FontItalic = True
Me.Labelsearch.FontBold = True
End Sub

Private Sub Labelsearch_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Labelsearch.ForeColor = 255
Me.Labelsearch.FontItalic = False
Me.Labelsearch.FontBold = True
End Sub

Private Sub Labelsearch_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Come back to initial state when button release'
Me.Labelsearch.SpecialEffect = 1
Me.Labelsearch.BackColor = 16373685
Me.Labelsearch.ForeColor = 8388608
Me.Labelsearch.FontItalic = False
Me.Labelsearch.FontBold = True
End

If I create a command button with the wizard and assign the code :
me!itemquery.Requeryto the on_click event my form is working fine.
Why is his code is not working if I assign it to a label? :o


View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Code Triggered From Label On Click Behaves Differently From Command Button On Click
Often I use Labels as buttons due to the fact I can colour them the way I want, and use the on click event to trigger code.
The code below however works for a command button, but not a label button.

DoCmd.OpenForm "frmdatetime"
Do While Forms!frmdatetime!OKFlag.Caption = "False"
DoEvents
Loop

When this code is run by clicking on a command button, it works fine.
If run by clicking on a label, frmdatetime opens, but the mouse will not work on either of the 2 open forms unless you go down to the windows task bar, jump onto another window, and back onto frmdatetime.
If I remove the loop with the DoEvents in it, then the problem does not occur.

Can anyone enlighten me as to why this behaviour occurs.

Thanks

Richard

View Replies !   View Related
Label In Front Of Button
I have a button on a form that is hidden, the button has a label over it, both are normally hidden.

When the user presses another button on the form I need these to appear but however I do it, the label appears behing the button.

Ive sent the button to the back and brought the label to the front, both by default are not visable

when the user clicks the button I run the following psuedo code

me.button.visible = true
me.buttonlabel.visible = true


any ideas?

regards

Andy

View Replies !   View Related
Command Button To Set Value
I have been working on this for awhile, and can't figure it out for the life of me!

I have a form set up with a drop down box that lets me pick from values from a table based off of the Primary Key of that table (Row Source = SELECT Order.OrderID, Order.OrderName from Order). I have a button on the form that I want to set a value (Closed) from the table entry based off of the order selected.

Pseudo code would go something like this.

Closed.Value = True Where Table.Order.OrderID = SelectedOrderID



Table.Order is a Table Named Order (obviously)
Closed is a yes/no field in my Order table
OrderID is the primarykey of the table Order
SelectedOrderID is the drop down box.

Any help would be greatly appreciated!

View Replies !   View Related
Command Button?
I, unfortunately, have been singled out as the Access guru in my work area. We have 223 people and the Information Manager has tasked me to modify a database he "found" to be able to track a number of things, but most important to him: performance reports.

I have posted the sample of what I currently have. What is being asked of me is a way in which to have a button or by double-clicking a block where a date would go for all other dates on the form to become non-visible while the current date stored in the computer the database is being worked from be entered in the block where the button or double-click happened. All this links to a report for the IM to be able to track what performace reports are out, and when they are due back to his section. He also wants me to be able to show which are overdue and where they are at. I am not sure if it is at all possible, but with me having spend most of last week purusing the articles on Access here, I know now that nothing is implausible if you happen to go about it the right way.

Since I have read the rules on posting, here is what I have done. I searched the forum for command button and got a lot of really cool ideas to use elsewhere in the database. I looked up the help in the program itself for command button, and got some good information on how a command button works, but I cannot make it put a date into a block. I can enter the date in any block that is a date format, but then I have dates in every block. He only wants to see the most current date in any of the blocks.

Any assistance at this point would be appreciated. If I have missed something in another thread, I apologise in advance.

View Replies !   View Related
Command Button %
how can i assign a formula to a command button?

also can anyone give me specific advice about calucalating the % of check boxes ticked across multiple records.

thanks in advance

View Replies !   View Related
Command Button
A couple of weeks ago I asked the question of how to send a single record from one table to another (Archive table) using a command button. I got a response. I have had time to work with this a little. My problem is I keep getting a error message "Run-time error '3075'; Syntax error (missing operator) in Query expression "[New ID]='. I wanted to mention that the archive table has an "archive ID" field as well as "New ID" that links the tables. I have the following code. Please help with this if possible.

" Private Sub Command667_Click()
' Save the main record if it has not been saved.
If Me.Dirty Then
DoCmd.RunCommand acCmdSave
Me.Recalc
End If

If MsgBox("Do you want to archive this record?", vbYesNo) = vbYes Then
Dim SQL As String

' Move main record to Grants Activity Archive.
SQL = "Insert into [Grants Activity Archive]" & _
" select * from [Grants] where [New ID]=" '" & Me.ID & "'"
CurrentDb.Execute SQL
Me.Recalc
End If

End Sub "

The error seems to refer to the & Me.ID section. I have tried putting Me.New ID and also Me.Archive ID. The Grants Activity Archives is the subform where I want the record to go. This subform is set up like a form with many fields so it is a lot of work to type the main record from the Grants table to the Grants Activity Archive table every time you want to archive a record. I hope that makes sense.

View Replies !   View Related
How Can I Use One Command Button Only?
Hi all

Can any one correct my attached program to make it works with one command button only please?

Using two buttons make conflict.

Any help will be highly appreciated.

Thank you

vbnt

View Replies !   View Related
Command Button
Hi I can't seem to be able to find any option to open a table from the command button wizard how is this possible. Thanks

View Replies !   View Related
Command Button
Hi,
How can I make command button on my DAP to use update query that I wrote? :confused:

View Replies !   View Related
Command Button Looks...
Hi everyone,

This is perhaps a simple question for which I have not been able to find an answer to. I've been trying to create a form which contain command buttons, but the problem is that the look of these buttons are not similar to those found in Windows XP.

I know itís purely cosmetic :cool: - but how do I make my buttons in Access 2003 to look like those on my Windows XP?

I've seen some samples here on these forums which have the 'XP' look. Any hints on how to do this would be greatly appreciated.

All the best,
Sab.

View Replies !   View Related
Command Button
Hi
I have a option group with 6 command buttons. The trouble is when you select a button, the button stays selected, so if you want to select it again you have to select another butoon then go back to it (hope this makes sence!). Is ther a way to re-set the button so it returns to un-selected mode!!!!
Thanks in advance!

View Replies !   View Related
Command Button
Question One
I want to create a command button in the form view that once pressed opens a folder that contains a photograph. I assume that I need to use a hyperink but how is it done?

Question Two
When in the form view and I press a 'Find ' button that I created I want to have a combo box/list box on the find. The alternative to this is that the reader has to remember all of the subjects. With a combo box/list box, or similar, the user can scroll down the list and pick and choose the subject to search for.

I would greatly appreciate any assistance on either question.

Cheers.

View Replies !   View Related
Command Button
hey guys...

is there a VB code by which i can tell a command button to add a new record in a specific table ???

View Replies !   View Related
NEXT Command Button
Hi..

I have a DATA ENTRY SCREEN FORM and i have the add,next,previous records etc... The thing is when a user came to the last record and press NEXT command button, he can insert a new record. I want the ADD button for insert a new record not the NEXT button. Can i fix this problem?????

Thanks
Andrew

View Replies !   View Related
Command Button Help
Hiya guys,

I have much help from this forum during my latest project, and all help has made me progress at a nice pace....So thanks guys.


The latest problems I have is to do with command buttons.
Really simple i`m sure, but could not find the answer in the search.

I have added a command button to search a refernec number field.
By Default, the search is set to "MATCH Whole Field"
Can I change this to default to "Match Any Part of Field" ???
I have looked in the code section, and cant see where this could be done... But i`m sure its just me not understanding what I`m looking at.


Thanks in advance for any help.

Max

View Replies !   View Related
Command Button
I have inserted a Command Button in a Form to open another form.

It opens the nominated form but the previous form is still on screen in front of the nominated form.

I have named the Command Button "Next >" just like you see on many forms and I want it to save the information, close the current form and go to the nominated form when clicked.

How is this done?

s

View Replies !   View Related
Command Button
I currently have a ordering database which i am using and runing fine.

The problem us I am using a tab control and command buttons with the products hard coded so for example the name of the product is the command caption and when a user clicks on the button it fills the subform product name with the commands button caption and the price is hard coded and the through vba inserted into the subforms price section an example of this would be ---

form_orderdetails.description =command1.caption
form_orderdetails.price = 1.50

The above is jus an example of what the code does in the command button

Now the problem is that i want to automate this so i can have a form called add/edit products for eg and i would like to say what tab control i would like the button to go what the button should be called (caption) and what price of the product....

View Replies !   View Related
Command Button
I have a command button I want the user to click to update the date field on a form and also unlock certain locked fields to input updated information. I have the date field set for =Date() and when they click on the command button I want the date field to update to the current date. Can this be done and how?

View Replies !   View Related
Command Button Help
I am sure this has been asked to death but I have no clue where to start. I have never used VB or access really for that matter. I went out and purchased a 50$ book on access and can't find my answer there either. I have enclosed a sample database for what I am trying to do. On form 1, I have a command button. I want that button to ask me for the file I want to import, and then have it import it into LOG BLANK. Does that make any sense? If there is anywhere else that I can read that might help me I would love it. I have been trying for 4 days now to get this button to work to no avail.

Thanks In Advance.

View Replies !   View Related
Command Button
I have a Form "MONTHLY ORDERS" and i want to add a Command button on Click Event to transfer me automatically to PivotChart View....

View Replies !   View Related
Command Button Help
Hello,

I have an inventory database. I am trying to create a button on my invnetory transaction form that will open another file on my server (PDF) so I can view the bill of lading for that transaction (as all BOL's are scanned and saved on the server). I am not sure how to enter the code in order to make sure the record I am currently viewing is associtaed with the BOL that is pulled up. Any ideas?


Thanks!

View Replies !   View Related
Command Button Help
Hey there. I have a contact database that I'm making an Emloyee Skills section for. I'm a little lost as I'm not a very technical person. I have a document detailing what I'm trying to do, with screenshots of my form in question and another screenshot of the related tables/fields I'm working with. I could upload somewhere or email to anyone who would be interested in helping.

In a nutshell, I have a listbox on my mainform populated by a table called SlillsInventory - and next to that a subform titled EmployeeSkillsSubform which is populated by a table named EmployeeSkills. I'd like to be able to select a skills from the Skills Inventory listbox, click the arrow button and have that highlighted skill popluate the employee's record in the EmployeeSkill table.

Can anyone provide any insight? Thanks in advance. - Kip

View Replies !   View Related
Shortcut For Command Button
hi to all,

does anyone know how to create a shortcut for a command button? For eg, the caption of my command button is SAVE. how do i create a short cut (CTRL + S) for it? thanx

View Replies !   View Related
Form With Command Button
Hi,

I created a form that lets the user choose specific criteria, through a combo box, to run a report that houses several subreports. Each combo box is referencing 4 queries needed to run the report.

=[Acctmgr_renewed_detail]![RenewalMonth] And [Acctmgr_begbal_2005]![RenewalMonth] And [Acctmgr_cancelled_sum]![RenewalMonth] And [Acctmgr_renewed_sum]![RenewalMonth]

The form also includes a command button to preview the report. However, when I click the command button, the prompts for parameter values for the report popup again, when it should just print the report. Below is the code attached to my command button:

Private Sub Command2_Click()
Me.Visible = False
DoCmd.OpenReport "Acctmgr_monthly_activity", acViewPreview
DoCmd.Close acForm, "valarie"
End Sub

Is there something I need to add to my code? If so, what? Any help would be much appreciated.

Thanks

View Replies !   View Related
Command Button Problem
Hello again,
I'm sorry to make so many requests all of a sudden, but I'm not well trained in access and was put in charge of making major modifications to our system. I need the code for the event procedure to make a command button change the size mode of an image box to zoom. I also want to make another to change it to cut. When it is set to cut, is there any way to have scroll bars so that you can scroll to see the whole image, and how could I include that in my event procedure for the button. Any help with that would be greatly appreciated!

P.S. - Just for kicks - Is there any way to use VBA code in an event procedure to open a photo in the default photo editor on my system?

Thanks Again !

View Replies !   View Related
Disable Command Button
I have a command button which will work on a specified date of every year. After the user clicks it once (which will carry out calculations), I want this button to be disabled so that it is not available for second click. Is it possible?

View Replies !   View Related
How To Add Record Thru Command Button In ADP
Hi all,

In access database project where my tables are linked from MSSQL server, how can I add record from the FORM itself using command button. Bcz it is not like mdb files in access that you can just drag a command button onto the form and take an action like add, delete, print or find rec. I just came to know it from immediate window using following SQL line;

Docmd.RunSql "Insert........

This is ok but how it could be done thru a command button on FORM.

Thanks in advance.

With kind regards,
Ashfaque

View Replies !   View Related
Disabling Command Button
Im new to this, and a beginner at database design, but I am currently stuck on disabling a command button.

Basically what happens is the form is loaded and there are two buttons (save and undo) both disabled:

Private Sub Form_Current()
Me!cmdSaveAddAd.Enabled = False
Me!cmdCancelAddNewAd.Enabled = False
End Sub

once a text box has been filled in the next occurance happens:

Private Sub Form_Dirty(Cancel As Integer)
Me!cmdCancelAddNewAd.Enabled = True
Me!cmdSaveAddAd.Enabled = True
End Sub

which enables both buttons. but the problem is when a user clicks the undo button i want both buttons to be disabled again, i cannot get the undo button disabled, the save button was easy enough:

Private Sub cmdCancelAddNewAd_Click()
DoCmd.RunCommand acCmdUndo
Me!cmdSaveAddAd.Enabled = False
End Sub

but if i put (Me!cmdCancelAddNewAd.Enabled = false) i get an error message saying 'you cannot disable a control that is in focus'.

View Replies !   View Related
Disabled Command Button
Hi all,

Thanks to a AWF member last week, I have managed to advance a lot further with the login screen I need but have hit a brick wall.

Below is the code I was given and at present, the code opens up the same form which is fine, but I need the form that opens to enable the delete client button for managers but disable it for clerks.

I was just wondering if anyone could give me some pointers on what code I would need to write to achieve this and where I would need to put this?

Any help would be gratefully appreciated.

Private Sub Command6_Click()

If Me.Password = Me.Combo10.Column(3) Then
If Combo10.Column(2) = "Manager" Then DoCmd.OpenForm "frm_Splash_Screen"
If Combo10.Column(2) = "Clerk" Then DoCmd.OpenForm "frm_Splash_Screen"
Else
MsgBox "Login Error"
End If

View Replies !   View Related
Command Button Error
Hi,

I have created a command button on a form which quite simply is meant to open a report.

However I get the error, as in the attached image.

Any idea why i'm getting it, and how to get rid?! I just want the button to open a report!

Cheers
amx

View Replies !   View Related
Shortcut For Command Button
hi to all,

does anyone know how to create a shortcut for a command button? For eg, the caption of my command button is SAVE. how do i create a short cut (CTRL + S) for it? thanx



i'm using access 2003.

View Replies !   View Related
Exit Using A Command Button
I have a form that has a command button on it. When the user clicks the command button I want the form that was up to be exited. I cannot find the correct syntax for this. Please help.

View Replies !   View Related
Command Button Problem....
I have a problem that just started today that I need help with.... When I create a command button on a form, I have always been prompted with a walk through what function I wanted to the button to execute. Today, Access just puts the button on the form with no prompting.... Have I done something to turn this feature off??? :confused:

Thanks in advance for your help...


Dave

View Replies !   View Related
Command Button W/ Tag Required
I'm using the following code, has worked fine on the beforeupdate on a forms control. Problem is I'm trying to use this as validation on a command button. When the command button is selected I want the code to go through and validate the fields in which the tag property is set at "required". When I run this it errors at Cancel = true, variable not defined.

Is there anyother method to validation on a command button.

Private Sub cmdSaveandmail_Click()
Dim blnContinue As Boolean
Dim ctl As Control
blnContinue = True
For Each ctl In Me.Controls
If ctl.Tag = "Required" Then
If IsNull(ctl) Then
MsgBox "Required Information Missing", vbCritical + vbOKOnly + vbDefaultButton1, "You must fill in the field indicated with red"

Cancel = True
ctl.SetFocus
Exit For
End If
End If
Next ctl
Set ctl = Nothing
end sub

View Replies !   View Related
Email Command Button
I searched the forums, I downloaded sample datbases EmailA2K, example, and PrintCurrentRecord_Update however I cannot get my command button to fill the TO: with my customer email address. I have gotten lost in the code so I went with a send object macro. Maybe it's my internet service. I use Compu Serv which is a by-product of AOL. Can that be the problem? Anyway I don't understand code, I wish I did. I select send object as my action in my macro. I leave the object type and object name blank as well as the output format. In the To: I put = [email address]. In the subject I put "From CG" and the Edit Message is set as "no". When I click on the button it opens up my email provider but nothing is in the To:. I first tried to fill in the Object name and type and format and it attached the records in the form, I DO NOt want to do that. All I want is to have the Email Address be filled in the To: by clicking a button. I'm about 8 hours on this and a little on edge. I would like to get a good nights rest and not think asbout this anymore. Any Macro help would be great.

View Replies !   View Related
Command Button Problems
I have a form with code behind a command button does a few calculations. Sometimes it needs to pull data from another record before it does this. All the calculations I have are correct, but sometimes the code does not work until I close the form and go back to that record again. I have added a save record button with the code in it, but it still doesn't work unless you close and then come back. Any ideas?

View Replies !   View Related
Command Button Code
This is code in a command button on a form to preview a report.
DoCmd.OpenReport stDocName, acViewPreview, "Control Room Query", "[Lot #] = Forms![Hydro COA]![LotNumber]"
What could I change in this code to use in a different command button to have the report sent as an attachment in snapshot format in an email? The user would have to fill in the address, subject and body of the email.
Thanks much!

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved