473,466 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

onclick event

65 New Member
i have a form to add new employees to...i want to be able to click ONE button and have it save the data,update the database, and close the form all at once.

any ideas how to do this?
i have the button for saving it, just not sure how to add the other two parts yet
Jul 10 '06 #1
5 6928
comteck
179 New Member
You said you want to save and update at the same time. If you have a form set up with a Record Source pointing to the table you want to save to, then it will save this data as you are typing it in. When you exit the form, the data should be in the next record of the table.

When you talk about updating a table, it means that existing data is going to be changed. If this is what you want to do, then you have to use an Update Query. You then open that query when you need it by adding the following code to a button on your form:

Private Sub btnUpdate_Click()
DoCmd.OpenQuery("queryname")
End Sub

Let me know if it's existing data you want to change in the table, or if it's simply adding data to the table because creating an update query is a little more complex than a normal query.. however it's not overly difficult.

To close the form, use:
DoCmd.Close

The overall code would be:

Private Sub btnUpdate_Click()
DoCmd.OpenQuery("queryname")
DoCmd.Close
End Sub

Have you ever looked at some of the online tutorials for MS Access? There are some great ones out there.

Hope this helps.
comteck
Jul 10 '06 #2
mpmason14
65 New Member
i want to update the form so it shows the new record while browsing after i close the form that adds the employee.
i hope this is making sense
im going to check the access tutorials also
Jul 10 '06 #3
comteck
179 New Member
I'm sorry. I'm afraid it's not making sense. Maybe somebody else can shed some light here.

It sounds like you're saying you want to update a form after the form has been closed. A form is just an interface for data that stored in a database. After the form closes, the data is lost from the form. Are you sure it's not a table that you want updated.

And if it is a table, I still don't quite get what it is you want to do.

comteck
Jul 12 '06 #4
mpmason14
65 New Member
i understand that the table is the underlying data source, and that is what is being updated. but i want the form to show the updated information without having to close the form and reopen it. is there a way to do this?
Jul 12 '06 #5
mpmason14
65 New Member
found this one out, too:

i added
Forms!frm_timesheet.Requery
to my close button on my form and whenever i close the form, it does exactly what it is suppossed to do...close the second form and requery (v. refresh!) the database and updates the form.

thanks to all of you with the ideas. hope this helps anyone who is looking for the same thing i was
Jul 12 '06 #6

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

Similar topics

2
by: Andreas Knollmann | last post by:
Hi, I create an object like this: var cell = document.createElement("td"). It doesn't have to be cell. I want this cell to use the onclick event. What doesn't work in the IE as well as with...
2
by: RobG | last post by:
I am trying to dynamically add an onclick to an element, however I just can't get the syntax right. consider the following function: function doClick (evt,x) { // do things with evt and x } ...
17
by: abs | last post by:
My element: <span onclick="alert('test')" id="mySpan">test</span> Let's say that I don't know what is in this span's onclick event. Is it possible to add another action to this element's onclick...
6
by: Cockroach | last post by:
Hello, I have a problem where the onClick of a table row will activates a window.location event, and inside a cell in that row, an image onClick event shows/hides a div. The problem is that...
4
by: RobG | last post by:
I have a function whose parameter is a reference the element that called it: function someFunction(el) { ... } The function is assigned to the onclick event of some elements in the HTML...
5
by: moondaddy | last post by:
I have a <a> element in a datagrid which wraps some asp.net labels. this element also has an onclick event which does not fire in netscape 6 (and perhaps other browsers for all I know...). Below...
5
by: kai | last post by:
Hi, In ASP.NET , what is the difference between OnClick and Click events for a button? Because we have button click event, it can trigger events, why we still need OnClick? Please help. ...
7
by: extremerep | last post by:
My task is to change the value of a button and then make it functional with the onClick handler. Changing the value to "Play Again" works, but making the onClick work accordingly does not. The...
4
by: sameergn | last post by:
Hi, I have an image in my HTML form which has onclick() handler. There is also a submit button and a text box. Whenever text box has focus and user presses enter, the onclick() event of...
5
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.