Help!Command Button Captions On Click
Aug 9, 2005
Hi all!
I have this command button whose caption switches from update record to save record with a msgbox verifying if the person really wants to take this action. On click the user is then allowed to update the record then in theory they would be able to hit the same button whose caption now reads save record, the msg box would appear with a yes or no answer required. The code I have is putting the msg box after the user clicks the update button.
Anyhelp and/or suggestions would be most appreciated!
Private Sub cmdOpen3_Click()
stDocName = "frmSearch"
If cmdOpen3.Caption = "&Update Record" Then
If IsNull(Me.FTMSubform.SourceObject) = False Then
Me.FTMSubform.SourceObject = "frmFTMInfo"
Me.FTMSubform.Form!txtFirstName.Enabled = True
Me.FTMSubform.Form!txtFirstName.Locked = False
Me.FTMSubform.Form!txtFirstName.BackStyle = 1
Me.cmdOpen3.Enabled = True
Me.cmdOpen3.Caption = "&Save Record"
Me.cmdOpen4.Enabled = False
Me.cmdOpen4.Caption = "&Update Record"
Else
Me.FTMSubform.Form!txtFirstName.Enabled = False
Me.FTMSubform.Form!txtFirstName.Locked = True
Me.FTMSubform.Form!txtFirstName.BackStyle = 0
Me.cmdOpen3.Enabled = False
Me.cmdOpen3.Caption = "&Save Record"
Me.cmdOpen4.Enabled = True
Me.cmdOpen4.Caption = "&Update Record"
End If
End If
If cmdOpen3.Caption = "&Save Record" Then
If IsNull(Me.FTMSubform.SourceObject) = False Then
Me.FTMSubform.SourceObject = "frmFTMInfo"
If MsgBox("Save update to this individual?", vbQuestion + vbYesNo, "Save Update?") = vbYes Then
DoCmd.Save
DoCmd.Close acForm, "frmFTM"
DoCmd.OpenForm stDocName
Else
MsgBox "Return to the FTMInfo Form!", vbInformation, "Save Function Aborted!"
End If
End If
End If
End Sub
~Van
View Replies
ADVERTISEMENT
Oct 28, 2005
I would like to display a continuous form with a command button whose caption is dynamic; such that the button text is determined by a field in the underlying recordset of the table.
So, if the field were forename : each button caption maybe : Brian, Peter, Sally etc.
Is this possible / and how can it be done?
Thank you.
G
View 8 Replies
View Related
Nov 7, 2006
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 4 Replies
View Related
Oct 18, 2013
I would like to make an append query to piece together multiple tables into a holding table, once the command button is clicked.
a) how to make an append query in vba,
b) How to call an append query on click of a command button?
View 1 Replies
View Related
Jun 26, 2014
I have a command button using this code:
If Me.Setfilter.Caption = "Search By Hedging Program" Then
Me.Filter = "Hedging Program"
Me.FilterOn = True
cmd.Setfilter.Caption = "Don't Search By Hedge Program"
Else
Me.FilterOn = False
cmd.Setfilter.Caption = "Search By Hedging Program"
End If
Hedging program is the column from the table I am trying to filter, it is a yes/no column. I want it to return all yes values in my query if it says search by hedging program and if it says Don't search by hedging program I want it to disregard the filter. I also have it set so that when I click the button it changes the caption from one to the other. So I don't know if I really need the cmd.setfilter lines because they may do the same as my command button on click function.
View 14 Replies
View Related
Apr 14, 2012
I have a command button on a Web Mutli-Record form that is using a "= [Report_URL]" value within the Hyperlink Address property. This all seems to work other than the fact that when the link popups up it has a "#" on either side that basically makes it an invalid address. How do I get rid of the # signs to get the web address popup in the URL when a user clicks on the Command Button that is associated to the row the record is on.
View 4 Replies
View Related
Nov 12, 2014
I need to return a folders directory to a text box on my forms record called Files_Directory when i click the Browse command button... The folder will have more folders within it along with documents all relivant to the folder selected, hense the need for just the folder directory rather than a file.
View 12 Replies
View Related
Sep 18, 2007
Hi There
I am wandering if anyone has a solution to this problem i has basically have 2 tables 1 called departments, with the fields: Dep No, Dep Name, then i have another table called Items, with the fields: Item No. Item Name, Item Price, Department.
What i want to do is create say 10 command buttons and create an array of them i know sort of how to do it in visual basic and all the 10 command buttons name is the same and an aray is created but i dont know how to do it in access i know that it doesnt let you create an array but i have seen it done somehow in a project that i came across.
so basically what i would want to have done is on the form load the 10 department buttons captions are loaded from the table departments and when a department button is clicked its is linked to items where i ahve created say 20 command buttons called items.
I dont know it it makes sense what i have written but any help on this matter would be very apreciated it pr if anyone knows of any examples as i have been stuck on it a while
Many Thanks
View 6 Replies
View Related
Nov 13, 2011
I want the caption for buttons in my Form to be pulled from a record in a table. Additionally, I want the name of the related form or report opened from the button to be pulled from the same record. I've been looking into this and it seems like using DAO is one option,I've already go the table set up, that was easy enough.
View 7 Replies
View Related
Dec 17, 2013
I am rewriting an old Access 2003 database in Access 2010. When creating new command buttons, the current theme gives them a default appearance. I need to apply this appearance to old command buttons. I know there is a way to select the default button and apply its properties to others quickly. I have done it before but didn't write the process down .
View 2 Replies
View Related
Feb 19, 2014
I have created a web-database (? - There are globes over all the forms and tables icons) based on the Issues & Tasks template. This means that most of the data is entered and seen on the "Main" form, which has two tabs - Open Issues and Closed Issues. I have created a form that allows people at my work to input the necessary data and save it, so that it will show up on one of the two tabs. However, once a record has been created, I want to be initially locked if the ID/PK is clicked, so that data can't be changed or entered inadvertently.
SO, I changed the code so that when the ID/PK for a record is clicked, it brings up a different form, but one that looks exactly like the one that is brought up when entering a new form, but I locked all of the fields so that the information cannot be changed. It seems from what I have read that I can create a button on this form so that when clicked, it unlocks the fields on the form so that they can be changed, and then when clicked again it will lock the fields again. Is this true? If so, how can I do it? Or is there something similar I can do? I have seen codes that I could copy and paste, but I cannot figure out the place to copy and paste codes in Access 2010.
I have changed the Form properties so that Data Entry and all the "Allows" are set to No...
View 9 Replies
View Related
Jan 24, 2006
Dont be overwhelmed by the following, but it may require some extensive thought and I dont expect everyone to understand....
I want to have a unbound form control a subform. On the form I have an unbound text area entitled txtDate. In this area it displays the current date being viewed. I have put left and right buttons on the main form that will add (+1) one day to the date being shown and subtract (-1) one day from the date being shown. I want to conrol it though the "On Click" but I dont know what to enter in the "On Click" field that will allow me this. The reason is, co-insiding with the previous, when the date is changed, the subform is also changed to a new day. Therefore instead of displaying 24 hours of today, you can view 24 hours of yesterday, tomorrow and so on. See, if one is to set the onclick to be: Me.txtDate=Me.txtDate-1, or Me.txtDate=Me.txtDate+1, it calls for a custom macro and I dont know why. I know it somehow resides in some similar command set up.
I also need to know how to make the subform bound but continous, and what exactly does that mean?
Anyone care to offer some assistance? :confused:
View 4 Replies
View Related
Jun 27, 2005
Hi everyone!
First, I want to say I would REALLY appreciate any help I could get with this problem. Let me lay out the details.
I DO NOT, DO NOT, DO NOT know the first thing about programming for ms access. I am an absolute novice, no exaggeration at all. I was a liberal arts major in school!!!!!
Here's the thing: being adventurous and all, about 2 years ago a co-worker and I were fiddling with databases to try and help out our employer keep track of dispatching his equipment for his business. With a little too much time on our hands, before we knew it, our database became fairly complicated, for such novices. A kind gentleman on this forum did us an enormous favor, and programmed a search form for our database. you could enter any or all of the id #'s for various equipment, and it would pop up in a list box. Double-clicking the listbox would open the particular record you were looking for.
Fast-forwarding to now, I'm trying to create another database to keep track of our inventory while while various equipment moves in and out of our yard. I have tried using the old search form as a foundation to create a similar search form for this db. I think I actually have it (kind-of) working! You type in a container number, and the record should pop up. which is a miracle all its own.
problem is, is that when you doubleclick the selection in the list box, I receive the following error:
"Run-time error '3075':
Syntax error (missing operator) in query expression '[ShipID] = '.
I click debug, and visual basic brings me to:
DoCmd.OpenForm "Inventory Table Form",,, "[ShipID] = " & Me.lstInfo
I don't know what to do! I'm sure it must be something painfully simple or obvious, but I'm really stuck & would appreciate any help.
Also, I would really appreciate any advice on this: I'd like to also be able to search by chassis # in addition to container number, but i don't know how to do it. no big deal, though. THANKS SO MUCH!!
p.s., I've attached the db. please let me know if you can open it ok
View 1 Replies
View Related
Nov 4, 2004
I'm new in access world. please help. I have many forms that control by On click command from the main form. One of the form (which is Calendar form), I like to have password protect in away that only the right ID or password would have access to edit this Calendar, If not users can only view it. Is this possible?, if it is can you please provide some code for me...Thanks in advance..
View 1 Replies
View Related
Aug 13, 2014
I have a form that i used the following code on to stop people accessing anything naughty:
Code:
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
This works great and gets rid of all the menu bars.
The problem is that it also stops the user getting the right click menu up in a datasheet view.
I assume i just need to enable the correct menu bar index number but i don't know what it is so my code would be:
Code:
CommandBars(X).Enabled = True
So do I need to bring back more than one command bar to get it working?
View 4 Replies
View Related
Aug 12, 2005
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 6 Replies
View Related
Sep 20, 2006
Ok if I sound like I do not know what I am talking about, that would be correct. That is why I am asking here.
So I have this form called frm_UserMaintenance
On The form I have a button
I would like to have an OnClick event that will activate one of the dialogue boxes on the tools menu.
Heres the catch. The menu is not visible and i do not want to make it visible. This makes using sendkeys a non option.
Any ideas????
View 5 Replies
View Related
Feb 9, 2005
I have a form on which I have a button that I want the user to click after a cetrain field on that form is updated.
I display a little pop-up box saying to make sure that a user clicks on that button.
Is there a way to know that this button was clicked? Is there a way to not proceed with anything else until that button is actually clicked?
Thanks.
View 4 Replies
View Related
Sep 19, 2005
Hi,
I have a form with a number of drop-down lists on it and each of these lists is bound to a field in a table.
When I return the results of a search to this form I want to allow users to be able to cycle through the records and change them if they want. However, the changes should only be saved if the user clicks on the "update record button". This button is simply the save record button by the MS Access wizard.
At the moment if they change the value in one of the drop down lists and move onto the next record the change is saved even though the user doesn't click any button. I want to prevent this from happening.
Any ideas on how I might achieve this?
If I prevent "AllowEdits" in the form properties I can't update the form using the "update record button" either.
Many Thanks,
View 2 Replies
View Related
Nov 10, 2005
Afternoon people,
Just a query (no pun intended). Is there a way to ping an ip address which is taken from a table and at the click of a button it pings? Bringing up the cmd app to show the results.
Cheers,
Storm1976
View 1 Replies
View Related
Nov 22, 2005
I currently have a form with a button that once clicked displays a word document,however I have to double click on the button even though the code is on the single click event property.The only line of code is as follows
OLEFile.Action = acOLEActivate
Does any body know how I can get the single click to work ?
View 2 Replies
View Related
Sep 6, 2006
Hi all....
I have a list box that I can select mulitple items from - I then click a search button and it runs a query that finds what I am looking for from a table and then displays the results in a subform.
In the subform I can input weights and get a percent....anyhow.
How do I set up a button so that it will print out a report or the report from the subform information that is currently being viewed.
Also, I can already do this by clicking a button on the form and pulling up the installed report program but, you need to input data to get this report.
I kinda want this button to be a "I need it now" type of print option.
Thanks...as always my questions are probably confusing...:D
View 2 Replies
View Related
Sep 7, 2006
I was wondering if there is any way to control a user's input in to a form such that data entry does not automatically create a new record. Is there any way to collect all inputs in the text/combo boxes and create the new record only when a button is clicked? Cheers, David.
View 1 Replies
View Related
Oct 26, 2005
Adding Records Only On Button Click?
I am building a database with a single table of records. I have created a form to allow new entries to be made to the table in a user-friendly way.
The problem I’m stuck with is how do I restrict the addition of new records on the form? I want the new record to only be added to the table upon the click of a button, but at present if I tab through, or exit the form the record is saved anyway.
Not all fields on the form are required input so I’m thinking that validation of every field is not the way to go.
I only ever want the record to be saved if a user clicks on a button and under no other circumstance.
I've been trawling through the posts back to about page 15 so any help would be appreciated.
Ksan
View 4 Replies
View Related
Feb 6, 2006
Hello everyone!I need to call the button_click procedure for a button on a form (button1), from another form, if you see what I mean!.Basically the user opens form1. They click a button which opens form2. Once they have finished on form2 they press the close button, which is the point where I need to call the button1_click procedure on form1.I imagine it's something like this:Call Forms![frmForm1]![button1]![Click] orCall Forms.[frmForm1].[button1_Click()]But no matter what syntax I try it just won't work! They're very basic forms, with only 2 buttons on and basic commands.Any help appreciated! Thanks
View 5 Replies
View Related
Mar 16, 2006
How can i deactivate mouse second button click on form?
Can anyone help me please?:)
View 1 Replies
View Related