473,899 Members | 3,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to save the value of unbound text boxes to field in table

8 New Member
hiiii
i have form(Main form) that contain textboxes(f1,f2 ) and a button (f3)
when enter values to text boxes and click the button i want
the values saved in fields(Password s,Names) that Exists in table called(Password s)


thanks in advance
Mar 8 '13 #1
7 14784
Seth Schrock
2,965 Recognized Expert Specialist
Here is a link to the MSDN website that shows the Recordset.AddNe w method: Recordset.AddNe w Method (DAO). You would just use something like
Expand|Select|Wrap|Line Numbers
  1. rst![Field_Name] = Me![Control_Name]
to pass the values in the controls to the proper fields.
Mar 8 '13 #2
aannll
8 New Member
thank you so much
please can u help me in my code
Expand|Select|Wrap|Line Numbers
  1.  Dim sql As String
  2. Dim sq As String
  3.      Dim LName As String
  4.   Dim LNa As String
  5.  
  6.   LNa = Me.f1.Value
  7.      LName = Me.f2.Value
  8.  
  9.      If Not IsNull(LName) And Not IsNull(LNa) Then
  10.           sql = "INSERT INTO Passwords ([Passwords]) VALUES ('" & LName & "')"
  11.  
  12.                CurrentDb.Execute (sql)
  13.                 sq = "INSERT INTO Passwords ([Names]) VALUES ('" & LNa & "')"
  14.  
  15.                CurrentDb.Execute (sq)
  16.  
  17.  
  18.  
  19.      Else
  20.           MsgBox "Please enter the password"
  21.           Exit Sub
  22.      End If
  23.  
Mar 8 '13 #3
aannll
8 New Member
the value of the name and password save in separately records
i want to store them in the same record
Mar 8 '13 #4
mshmyob
904 Recognized Expert Contributor
You only need a single INSERT statement.

Expand|Select|Wrap|Line Numbers
  1. sql = "INSERT INTO Passwords (Passwords, Names) VALUES ('" & LName & "','" & LNa & "')"
  2.  
cheers,
Mar 8 '13 #5
Seth Schrock
2,965 Recognized Expert Specialist
That is because you have them in two separate INSERT queries. You need to combine them into one, like this:
Expand|Select|Wrap|Line Numbers
  1. Dim sql As String
  2. Dim LName As String
  3. Dim LNa As String
  4. Dim db as DAO.Database
  5.  
  6. set db = CurrentDb
  7.  
  8. LNa = Me.f1.Value
  9. LName = Me.f2.Value
  10.  
  11.      If Not IsNull(LName) And Not IsNull(LNa) Then
  12.           sql = "INSERT INTO Passwords ([Passwords], [Names]) VALUES ('" & LName & "', '" & LNa & "')"
  13.  
  14.           db.Execute (sql)
  15.  
  16.      Else
  17.           MsgBox "Please enter the password"
  18.           Exit Sub
  19.      End If
Mar 8 '13 #6
aannll
8 New Member
thanks very much for your answers
Mar 8 '13 #7
belkhedr
6 New Member
thank you for this code
Mar 8 '13 #8

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

Similar topics

2
8972
by: John Kreps | last post by:
(acc 2002) I've got six unbound text boxes on a subform that has a white background. Each of those six boxes has an expression that when true, will change its background from white to another color. These text boxes need to go behind a single line of other bound text boxes (which show the actual record). I.e., the purpose of the unbound text boxes w/conditional formatting is to highlight the record/background with one of six colors.
2
5600
by: Jayjay | last post by:
I've got a report that has a series of unbound text boxes that are being populated by some variables in code. The format is supposed to be a currancy format, but on a certain series of boxes, I need add " ** " or something to denote those particular boxes so they can get the reader to see the footnote for those figures. The report is currently setup to put the text in those boxes in red. This is all well and good on the screen - but...
7
2374
by: Aravind | last post by:
Hi folks. I have 2 forms, frmBorrow and frmHistory frmBorrow has an unbound multi-column combo box (cboMember) and 7 unbound text boxes (MemNo, MemName, MemIC, MemType, CourseFaculty, Borrow, Due) frmHistory has the following text boxes: MemName, Borrow, Due
11
3280
by: amanda27 | last post by:
I have a form and there are some text boxes that show a score depending on what someone picks in the drop down next to that box. I did this part with some coding and therefore, for example if they choose the first option it could be a score of 0.1, if they choose the second option it could be a score of 0.25 and so on. I have the textboxes working correctly and at the bottom there is another text box called BV_Score. I am trying to get BV_Score...
7
13571
kcdoell
by: kcdoell | last post by:
Hello: I have a continous form that displays various forecasting records that an End user can add or edit the records (this feeds off of a query that I created called "ReQryForecast"). On that form, in the top corner, I placed 4 unbound text boxes that displays summary information. On one of them, "TxtBudGWP" I want to display the specific budget number for that particular month. This information is on a separate table I call tblbudget. I...
9
2105
by: RICHARD BROMBERG | last post by:
Please bear in mind that I am a newbie. I am posting this question a second time because the responses to my earlier post were a little wide of the mark. So, here goes: I am using Access 2000 and I would like to make a data entry form (frmDataEntry) with a two text boxes. The table (tblPeople) has fields Name and Age. Both are character fields. The Form has two text boxes (txtName and txtAge)
11
5208
by: jwessner | last post by:
I have a form (Form1) which contains basic Project data and a subform listing the personnel assigned to the Project as a continuous form. Selecting a person on that project and clicking on a command button will open a new form (Form2). Form2 has two subforms. Both are embedded in the main form. (Subform2 is NOT embedded in subform1.) Subform1 displays records as a continuous form based on the Primary ID of the main form and lists the...
1
2257
by: MyWaterloo | last post by:
I have an unbound text box on my main form that is used to show the sum totals in my sub form. I also have a field on my main form that has a control source in a table. This bound field needs to somehow have the total form the unbound text box transferred to it. How do I go about this? I have multiple categories that can be selected through a combo box. So I am sometime just flipping through categories to see what my total is. I could just...
7
3672
by: HSXWillH | last post by:
I am designing an inventory system and am stuck on a potential problem. I have a table of Stock_Catalog containing the following fields: Stock_ID (random autonumber), Full_Desc, Serial, Auto, Mem, RC, Trans_Type. These are the basic item descriptions. I then have 5 other fields: Add (yes/no), MRR (yes/no), Qty, Unit_Price, Item_Note that come into play when the user chooses which stock item is going to be part of the transaction. User...
2
3215
topher23
by: topher23 | last post by:
Disclaimer: I've already come up with a solution for this issue, but I thought I'd post it in the hope that it could help someone else and on the off chance that someone has another solution. I have a form for machine operator tracking. The form shows training-stage tracking dates with a lot of performance information. On the form is a subform for reviews, which uses a set of unbound text boxes to show current data for a review, which is...
0
9997
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9845
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11276
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10866
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10976
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10497
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7204
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4301
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.