PLS.... Help!!!
--------------------------------------------------------------------------------
hi commnunity
i have problem with sql,
i have created a table in Access Named TABLE1 in TABLE1 i have EmployeeNumber, Section, Posotion;
i assigned EmployeeNumber as text1.text
Section as text2.text
Posotion as text3.text
i have buttons name ADDrecord,
here is my code: - Private Sub Command1_Click()
-
Dim EmployeeNumber As String
-
Dim Section As String
-
Dim Postion As String
-
-
Dim strSQL As String
-
Text1.Text = EmployeeNumber
-
Text2.Text = Section
-
Text3.Text = Position
-
-
strSQL = "INSERT INTO TABLE1 (EmployeeNumber, Section, Position) " & _
-
"VALUES('" & [EmployeeNumber] & "','" & [Section] & _
-
"'," & [Position] & ")"
-
Adodc1.RecordSource = strSQL
-
Adodc1.Recordset.Save
-
Adodc1.Refresh
-
-
-
-
End Sub
-
-
-
Private Sub Form_Load()
-
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Maan\My Documents\db4.mdb;Persist Security Info=False"
-
Adodc1.RecordSource = "SELECT * FROM Table1"
-
End Sub
is this Correct? pls.. make an example for me...
thank you in advance
Julius
--------------------------------------------------------------------------------
3 2039
Try this ... -
Private Sub Command1_Click()
-
Dim EmployeeNumber As String
-
Dim Section As String
-
Dim Postion As String
-
Dim strSQL As String
-
-
' Wrong way around Julius, should be
-
EmployeeNumber = Text1.Text
-
Section = Text2.Text
-
Position = Text3.Text
-
-
' no square brackets around EmployeeNumber, Section or Position
-
' as these are variables and not field or control names.
-
strSQL = "INSERT INTO TABLE1 (EmployeeNumber, Section, Position) " & _
-
"VALUES ('" & EmployeeNumber & "','" & Section & "','" & Position & "')"
-
-
DoCmd.RunSQL strSQL
-
-
Adodc1.RecordSource = strSQL
-
Adodc1.Recordset.Save
-
Adodc1.Refresh
-
-
End Sub
-
Mary
Try this ... -
Private Sub Command1_Click()
-
Dim EmployeeNumber As String
-
Dim Section As String
-
Dim Postion As String
-
Dim strSQL As String
-
-
' Wrong way around Julius, should be
-
EmployeeNumber = Text1.Text
-
Section = Text2.Text
-
Position = Text3.Text
-
-
' no square brackets around EmployeeNumber, Section or Position
-
' as these are variables and not field or control names.
-
strSQL = "INSERT INTO TABLE1 (EmployeeNumber, Section, Position) " & _
-
"VALUES ('" & EmployeeNumber & "','" & Section & "','" & Position & "')"
-
-
DoCmd.RunSQL strSQL
-
-
Adodc1.RecordSource = strSQL
-
Adodc1.Recordset.Save
-
Adodc1.Refresh
-
-
End Sub
-
Mary
Thans mary, but there an erro about Refresh, well anyway i'll try to fix eat, but if i cant , may be i'll go to you ... thanks Godbless you
julius
Thans mary, but there an erro about Refresh, well anyway i'll try to fix eat, but if i cant , may be i'll go to you ... thanks Godbless you
julius
Try replacing Refresh with Requery
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jerome |
last post by:
Hi, I'm a bit confused ... when would I rather write an database
application using MS Access and Visual Basic and when (and why) would I
rather write it using Visual Studio .Net?
Is it as easy...
|
by: bill |
last post by:
I am trying to convince a client that dotNet is preferable to an Access
project (ADP/ADE).
This client currently has a large, pure Access MDB solution with 30+ users,
which needs to be upgraded....
|
by: Dave |
last post by:
Hello NG,
Regarding access-declarations and member using-declarations as used to
change the access level of an inherited base member...
Two things need to be considered when determining an...
|
by: Simon Bailey |
last post by:
I am a newcomer to databases and am not sure which DBMS to use. I have
a very simplified knowledge of databases overall. I would very much
appreciate a (simplifed) message explaining the advantages...
|
by: Frederick Noronha \(FN\) |
last post by:
---------- Forwarded message ----------
Solutions to Everyday User Interface and Programming Problems
O'Reilly Releases "Access Cookbook, Second Edition"
Sebastopol, CA--Neither reference book...
|
by: Olav.NET |
last post by:
I am a .NET/C++ developer who is supposed to do some work with Access.
I do not know much about it except for the DB part.
Questions:
*1*
I am looking for INTENSIVE books to get quickly up to...
|
by: John |
last post by:
Hi
What future does access have after the release of vs 2005/sql 2005? MS
doesn't seem to have done anything major with access lately and presumably
hoping that everyone migrates to vs/sql.
...
|
by: com |
last post by:
Extreme Web Reports 2005 - Soft30.com
The wizard scans the specified MS Access database and records
information such
as report names, parameters and subqueries. ......
|
by: Mell via AccessMonster.com |
last post by:
Is there a way to find out where an application was created from?
i.e. - work or home
i.e. - if application sits on a (work) server/network, the IT people know the
application is sitting...
|
by: jasmith |
last post by:
How will Access fair in a year? Two years? .... The new version of
Access seems to service non programmers as a wizard interface to
quickly create databases via a fancy wizard. Furthermore, why...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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: 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...
|
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...
| |