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

Update a table using VB

Hello Again, (although I haven't figured out my other problem yet, I decided to tackle another obstacle!)

what I am trying to accomplish:
The Trainer will click a checkmark when a trainee finishes a specific class, this opens a prompt for the Trainer's password. When the password is entered, you push a button, the prompt closes and updates a field in the main form with the Trainer's name and another textbox with the current date.
What I've got...
I have a form named "frmRequiredGeneral" that lists the classes that a specific trainee needs to take in a continuous form. On this form are the Classname (txtClassName) a checkbox, (chkClassTaken), two textboxes (txtTrainer and txtDateTaken) all bound to tblRequiredClasses.

The checkbox, when true, opens frmPasswordReq, which is bound to a qry that displays all current employees and their passwords. I have an unbound textbox (txtTrainerpassword) and a command button (btnUpdate)
Hope this make sense so far.

What I want is the button once clicked, to update the Trainer field in frmRequiredGeneral with the trainers name after he inputs his password into the frmpasswordreq.

I have some idea how to go about this, but nothing I've done has worked at all.

Any help is much appreciated! (I am a 'tard with VB so please be gentle!!)
*_*BL
Aug 6 '10 #1
8 2490
NeoPa
32,556 Expert Mod 16PB
Surely first the trainer would select their name from [txtTrainer]. This should be disallowed in the code if [chkClassTaken] is already True. Continuous form's controls cannot be set locked/unlocked per record. They are form-wide.

When a name has been entered a prompt should pop-up (with format of "password" so not visible) to request the password. This would never be shown anywhere on the form. If the password matches then [chkClassTaken] should be set to True and the record saved.

Does this make sense to you?
Aug 6 '10 #2
I changed the txtTrainer text box to a combo box and renamed it cboTrainer. Then added an afterupdate for cboTrainer to open the form frmPasswordReq. (The combobox source is the qryCurrentEmployees, with fields labeled "LogOnName" and another for "Password")

How do I link cboTrainer from sfrmRequiredGeneral to txtTrainerPassword in sfrmTrainerPassword?

The password doesn't need to be saved anywhere just used as a confirmation of identity. It comes from a linked table called tblSecurity from another database.

In regards to being unable to lock 'Trainer' after entering the password; Is there anything you can suggest in replacement of this? I wish to block users from changing the Trainers' name or date once the information has been put it. I'm using a continuous form because it was the best way for me to show all the required classes that a Trainee had to take, rather than having to update one at a time, the Trainer can update multiple.

Thanks Again,
BL
Aug 6 '10 #3
NeoPa
32,556 Expert Mod 16PB
BabyLucifer666: I changed the txtTrainer text box to a combo box and renamed it cboTrainer. Then added an afterupdate for cboTrainer to open the form frmPasswordReq. (The combobox source is the qryCurrentEmployees, with fields labeled "LogOnName" and another for "Password")
I see no requirement for reading in the passwords - even in encrypted form.
BabyLucifer666: How do I link cboTrainer from sfrmRequiredGeneral to txtTrainerPassword in sfrmTrainerPassword?
You don't.
BabyLucifer666: The password doesn't need to be saved anywhere just used as a confirmation of identity. It comes from a linked table called tblSecurity from another database.
Indeed. Assuming you're using encryption then compare the encrypted version of the password entered into your unbound password TextBox with the associated value in the table from the record which matches the user name supplied and Bob's your uncle.
BabyLucifer666: In regards to being unable to lock 'Trainer' after entering the password; Is there anything you can suggest in replacement of this? I wish to block users from changing the Trainers' name or date once the information has been put it. I'm using a continuous form because it was the best way for me to show all the required classes that a Trainee had to take, rather than having to update one at a time, the Trainer can update multiple.
I would suggest a BeforeUpdate() of [cboTrainer] and set Cancel = True if you find [chkClassTaken] to be true. In other words :
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboTrainer_BeforeUpdate(Cancel As Boolean)
  2.   Cancel = Me.chkClassTaken
  3.   'You may want to include operator notification...
  4.   If Cancel Then
  5.     'MsgBox(etc)
  6.   End If
  7. End Sub
Aug 6 '10 #4
Hello Again,

I'm still attempting to accomplish this the way I had originally imagined it. So far I have accomplished a few things:

I have the main form with a subform, "sfrmrequiredgeneral", it has a yes/no control, "chkClassTaken", and three text fields "txtTrainer" and "txtTrainee" and "DateTaken"

when chkClassTaken = -1(true) "frmTrainerPasswordReq" opens, it has one unbound text field with the following code as its afterupdate:

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtTrainerpassword_AfterUpdate()
  2.     Dim WhoIsIt As String
  3.  
  4.     WhoIsIt = Nz(DLookup("[LogOnName]", "qryPasswordLookup", "[Password] = txtTrainerpassword"))
  5.     If WhoIsIt = "" Then
  6.         MsgBox "Invalid Password."
  7.         Me.txtTrainerpassword = ""
  8.         GoTo Ending
  9.     End If
  10.     Me.txtTrainerpassword.Value = WhoIsIt
  11.     Me.txtTrainerpassword.InputMask = ""
  12.  
  13. Ending:
  14. End Sub
When I type in my password (***) it returns my Name. I want that value to be entered into the textfield in the subform for trainer using a button (maybe), an update query?? i dunno, but thats what i want, is it possible?

Thank you much...
BL
Aug 13 '10 #5
I figured this out. I have a button, btnUpdate, when clicked :

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnUpdate_Click()
  2.     Form_sfrmRequiredLevelI.txtTrainee.Value = Me.txtTraineepassword
  3.     DoCmd.Close
  4.  
  5. End Sub
So basically, the check leads to the password form, the form looks ups the user based on the password entered (code in previous reply) and the button updates the subform with the text from the password form. the textbox on the subform is kept locked so it can not be edited by anyone else. yay.
BL
Aug 13 '10 #6
NeoPa
32,556 Expert Mod 16PB
Have you considered what would happen if two users chose the same password?

I did try to warn you against this approach BL, but ultimately only you decide which approach you use.
Aug 15 '10 #7
We discussed it recently in a meeting, we work with people that have very little computer knowledge, the system admin, myself and the Training manager decided to create a password based on the employees initials and birthdate. I personally don't agree with it, but its not my call.

Thanks for your help however.

BL
Aug 16 '10 #8
NeoPa
32,556 Expert Mod 16PB
'Tis often the way I fear. Those with understanding are so rarely in positions to make the decisions.

Good luck anyway :)
Aug 16 '10 #9

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

Similar topics

1
by: DChrist | last post by:
I am unable to update a table (either by opening it and entering data directly or through a form). I have set the recordsettype property to updateable snapshot and have set the permissions to...
3
by: GL | last post by:
Hi, Is there a way to add a field to an existing table using a query of some sort (without needing to manually add a field to the table). I know how to do it with a make table query, but I have...
4
by: gj | last post by:
Hi, I'm trying to update a sql database from a web form using text boxes. I'm trying to learn C# on my own so I am at a complete loss. I created my sql connection, data adapter, dataset and data...
3
by: Yakimo | last post by:
Hi I am trying to append some records form tmpSource to tmpDest table using datasets Tables tmpSourec and tmpDest are identical. My setup is the following: - daSource - data adapter for...
1
by: Bo Long | last post by:
I believe the following a valid SQL statement, but MS Access returns with an error "Operation must be an updateable query". Any suggestions would be greatly appreciated! UPDATE FERCPTILoad AS...
5
by: SQL Learner | last post by:
Hi Alex (Kuznetsov) and All, This is to follow up with my last post, "Link two tables using partial word match". How can I UPDATE table using partial word match? How can I write a SQL statement...
1
by: TonyJ | last post by:
Hello! I trying to update a table using sql server but no update will be done. I don't get any error at all. Here is an extract from the code. Does this seems to be right.
3
by: Ciara9 | last post by:
I am having problems trying to update a field in a database using a field in a form. I currently have two fields, Today and Tomorrow in a table named Date. The Today field automatically defaults to...
1
benchpolo
by: benchpolo | last post by:
I have 2 tables Table 1: Invoice Table 1 fields: ClientName, PostedPaid (Yes/No) Table 2: History Table 2 fields: ClientName, DatePaid Overview In form level when the user click SAVE the...
1
by: adithi | last post by:
My Table Structure is: Table A Table B Table C colA -PK Col B-PK Col C-PK Col B-FK ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.