Attached is a project I am working on. It's a personal reminder program. The problem I am having is that when I enter the actual completion date at the bottom and click on the "Complete Task" button, I want the record to be copied to the History table, then the Start Date and Due Dates reset based on the Frequency. If someone could look at the On Click event procedure for this button and help me get this fixed, I would appreciate it very much. I don't know much about VB or SQL coding.
I have a tabbed form in a navigation form with a chart on it. The records source of the chart is a query. The query runs when you click the tab and takes a long time. I changed the Row Source of chart to "" and that eliminates the query running on form load. I've read many posts on changing that row source when a command button is clicked. I tried
in the onclick event of the command button. This doesn't work. I've tried many variations of the syntax. I don't know if I have to tell the query to run after the row source is changed.
On a side note, the query criteria is based on beginning and end dates entered into text boxes on the form. This all works if the query loads when the form is opened.
I have an access form and there is a textbox in which i enter a string and have a search button so I need the onclick event procedure to search a string from my table. so how do i do it in access 2010.
I would like to make clickable labels on my form, so if the user has any questions about the field, clicking on the label would bring up a message box that would give them more information. I know how to write onclick events one by one for every label, but there are a lot of them, and I feel like there has to be a better way.
I put the label names, and the text I'd like for the message box in a table, and I'd like to have a module that will allow me to click on a label, and have the right text come up.
I've researched ways to do this and have come up with nothing. The farthest I've gotten is an array tied to the form open event that just displays all the message boxes from first to last, one after the other. I believe that's on the right track, but is not a workable solution as is. I need to be able to tie the message box to the actual label the user clicks.
Visual Studio IDE environment and I have been working with Access VBA for almost a year now.
I am very used to generating my form controls in runtime and being able to create some cool user interface interactions by being able to say btnExample.OnClick += MyDynamicClickFunction
I have a continuous subform which essentially comprises of a textbox that shows a field from a query.
The text in that box is essentially a few letters and a few numbers - what I am wondering is if I can have an on click event for the textbox, that when a user clicks the text it takes them to the record (in a different form) that matches the text contained in the textbox they clicked?
So on a command button I have this code in the OnClick event. When I click the button it will ask me to enter the name if blank but if I enter something in that field and then delete the data is bypasses this. Does the same reason field, Why?
Code: If IsNull(Me.CE) Then MsgBox "Please enter your name" Me.CE.SetFocus Exit Sub
I tried to dynamically set image OnClick property to function with couple of attributes. Everything works well, but... it launches the function automatically without any mouse click! What is causing this? I want to execute the function only on the result of mouse click.
I have a table that holds the SQL texts for ca. 1000 Select queries (mostly minor variants that are used to programmatically swap out RowSource strings for combo boxes). I'd like to have a quick and easy way to open/review/modify these queries.
One strategy would be to display the SQL strings in a field on a Datasheet form, then use an onClick event on a text box linked to the SQL-holding field (or perhaps an onClick event tied to an unbound text box on the form) to open the associated query. That would allow me to view the SQL of the query that I want to open, allow me to quickly scroll through the list of stored SQL texts, and give me options for sorting or limiting the SQL-texts displayed in the datasheet form.
But, I can't seem to get the onClick event to work. The problem seems to be that I can't figure out how to pass the SQL string contained in the field to a function that will use that string to open the query .
I am try to open a form from another and set a button's OnClick properties to a function and I keep getting an error message..Run-Time Error 2450Cannot find the referenced form ..And this is the code I am using.
I am working on a database which has two tables used as part of a registration and login process.
I would like a couple of fields from table one to automatically update in table two, once the fields in table one are populated without using an 'on click' event.
The reason I would prefer not to use an onclick is because the completion of the form used to generate the users table does not require any buttons for the data to save.
does anyone have any idea on how to disable a button after the event has been run? I want to give the user a few options on a form. When one is depressed i would like that option not to be available any more.
I tried forms![frmmbiinfo]![command10].enabled = false
but i guess i need to refreash the page somehow. All i keep getting is an error saying "Object doesnt support this proerty or method"
I am making updates to an existing access application created by someone else a while back. I am a programmer by trade, but have limited experience with access and VBA.
What I am trying to do is tie some controls to the autoform nav buttons so when the user is moving through records the controls will be updated with the current records information. Something along the lines of an autoform.navarrow.click event.
The information I need to display comes from various other tables with one to many relationships. Not sure if this is the best way to go about handling this.
Would it be better to recreate the autoform based off of a query that does a join of the necessary tables? Think a customer table, items table and a purchases table(customer.id, item.id, date, quantity etc...)
Two other questions
1. Is there an event for tabs similar to onclick? So when I am clicking through tabs it will fire off an event.
2. I would like to fire off an event based on the current record in the autoform, how do I get that event to fire off when the form loads? I tried in form_load but it won't work. I am assuming because I am tying into the records ID, which isn't available until after the form loads.
I am using a timer function to hopefully calulate have long a call has lasted, I have setup a rolling clock called "ElapsedTime" and i have the start time running off the P.C. Time this is called "txt_Start", this works fine no issues.
Now comes the fun bit i have a button called "cmd_Finish", i wish the time to be calulated and the total time to be placed in a text box called "txt_Finish" sound easy but nope this would apear not to be.
The Following Setup is used:- ElapsedTime = "00:00:00" txt_Start = Time(), formated to LongTime txt_Finish = Formated to Long Time
Example of what i would like to happen txt_Start = 10:40:02 ElapsedTime = 00:00:11 txt_Finish = 10:40:13
I have tried the following Code: ********************************************* Private Sub Command5_Click() Me.txt_Finish = ([ElapsedTime] + [txt_Start]) End Sub *********************************************
Can anybody help me on this please.
Alastair :eek:
UPDATE *****************************RESOLVED THANKS TO ALASTAIR69 (ME) & Allan57********************
I was wondering if there is a way to disable a command button after it has been clicked for a small period of time. (lets say 1 second) stopping the user from any happy clicking. (fast repetitive clicks)
This is to do with viewing embedded images, i can explain more if required.
I have a continuous form with a button 'Cmd1' & a textbox 'txtMail' which is set to visible no.
When the user clicks Cmd1 - then txtMail becomes visible.
I can do it using vba on the buttons click event but when it executes txtMail for all the records become visible.
How do I use a button's click event on the form's current record - Private Sub Form_Current() so that when the user clicks Cmd1 on the current record only txtMail for that record becomes visible.
I have a FrmCadastro which updates my master table TblCadastro. Primary key of the TblCadastro is an auto numbered field named CADID.Fields CPF, NAME, FIN, NAT, TIP, MOT, and INSTREQ of the FrmCadastro are mandatory. My rule is that If any of these fields is null then the record cannot be saved (cannot be added into TblCadastro).
FrmCadastro has two distinct buttons, as follows: BtSave (to save either newly included record or changed record) and BtDelete (to delete a chosen record from my master table).To delete a record has not been a problem because under the click event of the BtDelete I use the following command lines to successfully eliminate an existing record (previously saved) from the TblCadastro:Dim numRecord As Integer
numRecord = Me.CADID Dim SQL As String DoCmd.SetWarnings False SQL = "DELETE * FROM tblcadastro WHERE cadid = " & numRecord DoCmd.RunSQL SQL DoCmd.SetWarnings True
To save a complete record (properly filled in) has not been a problem either since the code takes care of that very well.When the user is in the process of adding a new record through the FrmCadastro two different user behaviors can take place:
1. Irregular entering - The user for some reason just give up saving the record (he decides to add the new record later, for instance) by selecting the option Save = No, or 2. Incomplete record - By mistake the user try to save an incomplete record (a record that shows any mandatory field as null).
I coded the following command lines under the click event of the BtSave to take care of deleting those records... BUT it does NOT work. The system reads each line of the code, find the record properly, close the form as expected, but the incomplete record STILL REMAINS in the TblCadastro. I do not understand why, since the code is pretty much the same of the one in the BtDelete.
Code: Private Sub bt_save_Click() If MsgBox("The record was changed. Do you want to save it?", vbQuestion + vbYesNo, Me.Caption) = vbYes Then If MsgBox("WARNING! Incomplete record will be automatically deleted from database. If you did not fill in the fields CPF, NAME, FIN, NAT, TIP, MOT, and INSTREQ, the record will not be saved.", vbOKOnly, Me.Caption) Then If Not IsNull(CPF) And Not IsNull(Name) And Not IsNull(FIN) And Not IsNull(NAT) And Not IsNull(TIP) And Not IsNull(MOT) And Not IsNull(INSTREQ) Then
[code]...
What should I code to exclude both the incomplete record and irregular entering thru the button Save (options Yes and No) ?
I have a form with a control for the user to enter some data and then two command buttons 'OK' and 'Cancel'
For the OnExit event in the control I have a procedure that check the user input and if incorrect, opens a message box with an error message asking the user to correct the data. It then cancels the event so the focus remains in the current control.
However if the user presses the 'Cancel' command button on the form to cancel & close the form, the OnExit event for the current control still fires and asks the user to correct the data.
In my code in the control, how can I recognise that the Cancel command button has been pressed, so I can cancel the OnExit event and close the form?
I have a form (Pipeline) with an on load event that automatically directs the user to a new empty record.
Code:
Private Sub Form_Load() DoCmd.GoToRecord , , acNewRec End Sub
Now my problem is that I am trying to design a 'search form' that will allow the user to look up a specific record in the main form by pressing a command button. Creating the search form is easy enough. I cannot figure out how to override the on load event in the main form when pressing the command button.
As it is right now, the button opens the form and then go directly to a new record.
In the Main Form , I have few buttons and I am writing the following code to open the right form when a button is clicked but unfortunately the code isn't doing anything. No form is opening. I am using MS office 2010.
Code: Private Sub BtnOption_Click() DoCmd.OpenForm "Form1", acNormal, , , acFormAdd, acDialog End Sub Private Sub Form_Load() 'Me!Label1.Caption = "Welcome " & Environ("username") & "!"
I have a table with many records, using a form with an update button click event, I would like to update ALL records where the Item in the table = the Item in the form.
There are 6 checkboxes and 6 text boxes that will need to be updated, but right now I am just trying to test if i can even change one text box to keep it simple. I have tried to start by using this:
Code: Dim mySQL As String Dim ItemNo As String Dim SO As String
mySQL = "UPDATE BT200 SET Part = '" & SO & "' WHERE Item = " & ItemNo DoCmd.RunSQL mySQL
So every time i run this command button, it gives me a prompt "You are about to update 0 row(s)". Nothing gets updated at all, I am clearly missing something vital here.
Hi everyone!! This is my first thread in this forum..Hope to get best from this site ..well i m facing a problem..i have a main form and a subform (which is in datasheet view) . Now i have a button called "close_form" in main form on whose click event i have writen this code :
Private Sub close_form_Click() On Error Resume Next DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70 Me.Controls.Item("fees sub").SetFocus DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70 DoCmd.Close End Sub
1. If i run this form directly from Access and there are no changes i do in the form and click this button then it gets hang after showing error "run time error 2046 ; the command or action undo is not available now " "press End or Debug or help"
2. As i have created a Custom menu, if i run this form from that menu then it does not show any error. But it runs fine for the first time but nothing happens on clicking this button the second time i open the same form ( in same session). What to do ?? Please help .. shikha