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

Saving a Record

I have a Visual Basic program that is attached to a 97 access database. I have 6 buttons where users make themselves available and a caption pops up and states that "your name" has been made available. It also calls into play NOW which give the time on the keyboard/machine. How can i save this information with the time and name of the person into either a database or into a text file. Here is the code for one if the buttons.

Expand|Select|Wrap|Line Numbers
  1. [Private Sub cmdScharlette_Click()
  2.  
  3.  
  4.     On Error GoTo Errortrap
  5.    frmAssign.datAvail.Recordset.MoveFirst
  6.     frmAssign.datAvail.Recordset.MoveNext 'Move to the 2nd record(Scharlette's)
  7.     If frmAssign.txtAvail.Text = 1 Then
  8.         frmAssign.txtAvail.Text = 0
  9.         lblStatus.Caption = " " & Now & "- Scharlette has been made Unavailable."
  10.    ElseIf frmAssign.txtAvail.Text = 0 Then
  11.         frmAssign.txtAvail.Text = 1
  12.         lblStatus.Caption = " " & Now & "- Scharlette has been made Available."
  13.     End If
  14.     frmAssign.datAvail.Recordset.MoveFirst
  15.     RefreshAvail
  16.     Exit Sub
  17.  
  18. Errortrap:
  19.     wait (50)
  20. Return]
Feb 20 '07 #1
1 1156
Killer42
8,435 Expert 8TB
Could you perhaps add a couple of fields to your existing table, to hold the status (available or not) and the date/time? For example (keeping in mind I'm somewhat rusty on this stuff, and never have used the data control a great deal)...
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdScharlette_Click()
  2.  
  3.   On Error GoTo Errortrap
  4.   frmAssign.datAvail.Recordset.MoveFirst
  5.   frmAssign.datAvail.Recordset.MoveNext ' Move to the 2nd record (Scharlette's)
  6.   If frmAssign.txtAvail.Text = 1 Then
  7.     frmAssign.txtAvail.Text = 0
  8.     lblStatus.Caption = " " & Now & "- Scharlette has been made Unavailable."
  9.     frmAssign.datAvail.Recordset.Edit
  10.     frmAssign.datAvail.Recordset("Available") = False
  11.     frmAssign.datAvail.Recordset("When") = Now
  12.     frmAssign.datAvail.Recordset.Update
  13.   ElseIf frmAssign.txtAvail.Text = 0 Then
  14.     frmAssign.txtAvail.Text = 1
  15.     lblStatus.Caption = " " & Now & "- Scharlette has been made Available."
  16.     frmAssign.datAvail.Recordset.Edit
  17.     frmAssign.datAvail.Recordset("Available") = True
  18.     frmAssign.datAvail.Recordset("When") = Now
  19.     frmAssign.datAvail.Recordset.Update
  20.   End If
  21.   frmAssign.datAvail.Recordset.MoveFirst
  22.   RefreshAvail
  23.   Exit Sub
  24.  
  25. Errortrap:
  26.   wait (50)
  27.   Resume ' Not Return
Note, I'm working under the assumption that you're using VB6.
Feb 21 '07 #2

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

Similar topics

5
by: Jack | last post by:
Hi, I need to build a asp page where it would serve as a data entry record page as well as display page for records saved. This page should also allow editing of records that has been saved. ...
3
by: TheTenor | last post by:
I have a page with a graphic. I want to be able to define the graphics such that it is not saved when the viewer saves the page to his local drive. I'm trying to avoid having a seperate folder...
3
by: CSDunn | last post by:
Hello, I have an Access 2000 Project in which the data comes from a SQL Server 2000 database, and multiple users need to be able to see new records as each user adds records. The users also need...
1
by: Cillies | last post by:
Hello all, I was recently browsing the forum and remembered seeing a message relating to MS Access Bugs/Flaws. The thing is I cannot find that thread anymore, and so was wondering does anyone know...
13
by: Stuart McGraw | last post by:
I haven't been able to figure this out and would appreciate some help... I have two tables, both with autonumber primary keys, and linked in a conventional master-child relationship. I've...
11
by: kaosyeti | last post by:
i have a form that records 9 fields into a table. on that form i have a 'done' button to close the form. right now, if the form is fully filled in, but you don't press 'enter' before you click...
4
by: John Kandell | last post by:
Hi, I posted this in the asp.net group, but didn't get a response. Maybe someone here can help me with this... --- Would someone be able to shed some light on what is the cost of saving a...
1
by: google | last post by:
I have a form with several subforms. Users enter the data, then on the parent there is a command button that runs code to generate a .pdf document from a report based on the data they are working...
3
by: Andy_Khosravi | last post by:
I'm having a problem with an entry form on one of my applications. It would appear that the save action is sometimes not working, and is generating no error when it fails. I'm hoping one of you may...
1
by: Cesar Zapata | last post by:
Hi, I have a a bound subform and what i'm trying to do is do check if some criteria applies before saving the record and trigger a macro. basically this is what I got. Date Received ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.