saving a text box entry to a table (1 Viewer)

awse

Registered User.
Local time
Today, 13:17
Joined
Feb 27, 2013
Messages
15
Hi
I have a form named "Main frame", it contains a text box called "password", i want the password entered by a user in the form saved in a field called "voter" in "password" table.
hope u help in this
thank u all
 

John Big Booty

AWF VIP
Local time
Today, 20:17
Joined
Aug 29, 2005
Messages
8,263
Welcome to the forum.

You could do that with an Append Query, the SQL might look something like;
Code:
INSERT INTO TBL_Address ( voter)
SELECT [forms]![Main Form]![password] AS Expr1;
 

awse

Registered User.
Local time
Today, 13:17
Joined
Feb 27, 2013
Messages
15
thanx alot for reply but i really wish if u can give a vb code
 

John Big Booty

AWF VIP
Local time
Today, 20:17
Joined
Aug 29, 2005
Messages
8,263
VBA code will look something like;
Code:
Dim strSQL As String

strSQL = "INSERT INTO TBL_Address ( voter) " & _
             "SELECT " & [forms]![Main Form]![password] & " AS Expr1;"

DoCmd.RunSQL strSQL
 

awse

Registered User.
Local time
Today, 13:17
Joined
Feb 27, 2013
Messages
15
unfortunately it doesn't work :(
i made the table i want to store the data into it contains one field only and called it "passwords"

and i place the code like this in the main frame

Private Sub f2_AfterUpdate()
Dim strSQL As String

strSQL = "INSERT INTO TBL_address (Passwords)" & "SELECT " & [Forms]![Main Form]![password] & " AS Expr1;"

DoCmd.RunSQL strSQL
End Sub

really need help in this one
 

awse

Registered User.
Local time
Today, 13:17
Joined
Feb 27, 2013
Messages
15
sorry for that , i should replace the password field name with "f2" instead of "password"
but there is another problem, when i enter the password a prompt pops up asking me for parameter value, in contrary what i need is just save the password i entered in the table
hope am not confusing u
thanx alot
 
Last edited:

awse

Registered User.
Local time
Today, 13:17
Joined
Feb 27, 2013
Messages
15
please notice that the main form does not have a table, it just contain unbound text fields
 

pr2-eugin

Super Moderator
Local time
Today, 11:17
Joined
Nov 30, 2011
Messages
8,494
Try this code..
Code:
Private Sub f2_AfterUpdate()
    Dim strSQL As String
    strSQL = "INSERT INTO TBL_address (f2) VALUES ('" & [Forms]![Main Form]![password] & "');"
    DoCmd.RunSQL strSQL
End Sub
Why could this not be a BOUND FORM??
 

awse

Registered User.
Local time
Today, 13:17
Joined
Feb 27, 2013
Messages
15
thanx for reply
but also doesn't work
it's okay if i upload my work to see the problem?
it'a simple and easy to understand
 

awse

Registered User.
Local time
Today, 13:17
Joined
Feb 27, 2013
Messages
15
i have a problem in uploading :(
 

pr2-eugin

Super Moderator
Local time
Today, 11:17
Joined
Nov 30, 2011
Messages
8,494
Did you look into the link on how to upload in post #10?
 

Users who are viewing this thread

Top Bottom