-
Private Sub cmdAdd_Click()
-
txtid.Enabled = True
-
If txtid.Text = " " Then
-
MsgBox "Enter the id,Please!!!", vbOKOnly, "PAYROLL"
-
txtid.SetFocus
-
With txtid
-
.SelStart = 0
-
'.SelLength = Len(txtid.Text)
-
.SetFocus
-
End With
-
Exit Sub
-
ElseIf txtname.Text = " " Then
-
MsgBox "Enter the name,Please!!!", vbOKOnly, "PAYROLL"
-
'txtname.SetFocus
-
Exit Sub
-
-
With txtname
-
.SelStart = 0
-
' .SelLength = Len(txtname.Text)
-
.SetFocus
-
-
End With
-
'End If
-
ElseIf txtwhr.Text = " " Then
-
MsgBox "Enter the working hours,Please!!!", vbOKOnly, "PAYROLL"
-
txtwhr.SetFocus
-
Exit Sub
-
With txtwhr
-
.SelStart = 0
-
'.SelLength = Len(txtwhr.Text)
-
.SetFocus
-
End With
-
ElseIf Form1.txtrate.Text = " " Then
-
MsgBox "Enter the rate,Please!!!", vbOKOnly, "PAYROLL"
-
txtrate.SetFocus
-
Exit Sub
-
With txtrate
-
.SelStart = 0
-
.SetFocus
-
End With
-
ElseIf txtorate.Text = " " Then
-
MsgBox "Enter the Overtime Rate,Please!!!", vbOKOnly, "PAYROLL"
-
txtorate.SetFocus
-
Exit Sub
-
With txtorate
-
.SelStart = 0
-
.SetFocus
-
End With
-
Else
-
rs.Open "select * from empdetail Where ID='" & txtid.Text & "'", conn, adOpenStatic, adLockOptimistic
-
If rs.EOF Then
-
conn.Execute "insert into empdetail(id,name,whours,rate,otrate) values ('" & txtid & "','" & txtname & "','" & txtwhr & "','" & txtrate & "','" & txtorate & "')"
-
MsgBox "INSERTED NEW RECORDS", vbOKOnly, "ADDING NEW RECORDS"
-
Else
-
-
MsgBox "Duplicate Entry"
-
End If
-
-
rs.Close
-
Set rs = Nothing
-
ListView1.ListItems.Clear
-
addcol
-
Form1.txtid.Text = ""
-
Form1.txtname.Text = ""
-
Form1.txtwhr.Text = ""
-
Form1.txtrate.Text = ""
-
Form1.txtorate.Text = ""
-
End If
-
-
End Sub
-
Private Sub cmdBack_Click()
-
Form1.txtid.Text = ""
-
Form1.txtname.Text = ""
-
Form1.txtwhr.Text = ""
-
Form1.txtrate.Text = ""
-
Form1.txtorate.Text = ""
-
Form1.Hide
-
MDIForm1.Show
-
End Sub
This above code is for adding four fields to databse where id the primary kiey.Please go through because,its works for once,ie when one data gets inserted,u dont have any pblm.But whenthe computation is done for the second time without closing the window,an error occurs!!!
Please Go through...........!!!!!~
Where I HAve go wrong????
3 1188
code:vb
This above code is for adding four fields to databse where id the primary kiey.Please go through because,its works for once,ie when one data gets inserted,u dont have any pblm.But whenthe computation is done for the second time without closing the window,an error occurs!!!
Please Go through...........!!!!!~
Where I HAve go wrong????
Hello, Vbbeginner07!
What are you hoping the above code does?
I am just trying to get a handle on what you are asking for. Can you go into it a little more?
Dököll
Hello, Vbbeginner07!
What are you hoping the above code does?
I am just trying to get a handle on what you are asking for. Can you go into it a little more?
Dököll
Hi DoKoll,
the above code is for ADD ing datas to a database,the form actually contains five fileds
id ,which is the primary key
name(of employee)
working hours(emp)
rate(per hours)
overtime rate(if he does,per hours)
The code works for the very first time,ie when one data gets inserted into the database,if we click ADD button(command button)it gives errors,where i have given specific constraints for each field,why is it so...???
Where i have gone wrong??? Ant More explanation???
Nick
please try to use this -
conn.BeginTrans
-
conn.Execute "insert into empdetail(id,name,whours,rate,otrate) values ('" & txtid & "','" & txtname & "','" & txtwhr & "','" & txtrate & "','" & txtorate & "')"
-
conn.commmittrans
-
that might help you.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Adrian Parker |
last post by:
I'm reading/writing from Access using both EXECUTE() and Recordset methods.
I get weird errors though. For example I have 5 text boxes bound to fields.
I will change the data in a couple of the...
|
by: kinane3 |
last post by:
I'm guessing this has something to do with my cursor but I'm not sure.
this is for a picture gallery app and when I upload pictures some
pictures or records don't show up. this is what ia have so...
|
by: Ranjith Venkatesh |
last post by:
I read and write to a config file which is the data store for this Windows
Application written in C# using VS.NET 2003 in Windows XP.
Now I want to trigger the program to read the config whenever...
|
by: Jon Noring |
last post by:
Out of curiosity, may a CDATA section appear within an attribute
value with datatype CDATA? And if so, how about other attribute
value datatypes which accept the XML markup characters?
To me,...
|
by: Eric Lindsay |
last post by:
I can't figure how to best display little snippets of shell script using
<pre>. I just got around to organising to bulk validate some of my web
pages, and one of the problems occurs with Bash...
|
by: brett.estabrook |
last post by:
I have written a multi-threaded c# windows service in .net 1.1 (Visual
Studio .net 2003). The service has several threads that poll a Sql 6.5
database on another machine. Each thread will execute a...
|
by: Holger |
last post by:
Hi
I have not been able to figure out how to do compound statement from C
- "<test>?<true-val>:<false-val>"
But something similar must exist...?!
I would like to do the equivalent if python...
|
by: Anastasios Hatzis |
last post by:
I'm looking for a pattern where different client implementations can use the
same commands of some fictive tool ("foo") by accessing some kind of API.
Actually I have the need for such pattern for...
|
by: CuTe_Engineer |
last post by:
hii,
i have cs assignment i tried to solve it but i still have many
errors , plzz help mee :"< it`s not cheating becuz i`ve tried & wrote
the prog. i just wanna you to show me my mistakes
...
|
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: 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: 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...
|
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,...
|
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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |