Hello everyone,
I m using some button using toolbar such as Add,Save,View,. ... my save button is not working.... it doesnt give me any error but does not save to my database.... or showing in my gird... Plz Help
here is my code for save button -
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
-
On Error GoTo ChkErr
-
If Button.Index = 1 Then
-
Mode = "Add"
-
Call AddMode
-
Call ClearControl
-
Toolbar1.Buttons.Item(1).Enabled = False ' Add
-
Toolbar1.Buttons.Item(2).Enabled = False ' View
-
Toolbar1.Buttons.Item(3).Enabled = False ' Sort
-
Toolbar1.Buttons.Item(4).Enabled = False ' Edit
-
Toolbar1.Buttons.Item(5).Enabled = True ' save
-
Toolbar1.Buttons.Item(9).Enabled = True 'Exit
-
-
End If
-
-
If Button.Index = 4 Then
-
'If Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.RowSel, 8)) = "0" Then
-
Mode = "Edit"
-
Toolbar1.Buttons.Item(5).Enabled = True ' save buton
-
Call Enable
-
Else
-
MsgBox " Cannot Edit "
-
End If
-
-
If Button.Index = 5 Then
-
-
Call SaveMode
-
Call ClearControl
-
Call Desable
-
MsgBox " Record Saved For Id '" & txtId.Text & "'"
-
Toolbar1.Buttons.Item(5).Enabled = False
-
Toolbar1.Buttons.Item(1).Enabled = True ' Add
-
-
Call Address
-
End If
-
-
'End If
-
-
If Button.Index = 2 Then ' View
-
'Toolbar1.Buttons.Item(7).Enabled = False ' Final
-
Toolbar1.Buttons.Item(1).Enabled = False ' Add
-
Toolbar1.Buttons.Item(4).Enabled = True ' Edit
-
-
End If
-
-
-
-
If Button.Index = 7 Then ' Cancel
-
Db.Execute "Update Address"
-
Call Address
-
-
End If
-
-
-
If Button.Index = 9 Then ' Exit
-
Unload Me
-
End If
-
-
Exit Sub
-
ChkErr:
-
If Err.Number > 0 Then
-
MsgBox Err.Number & vbNewLine & Err.Description
-
Call ErrHand(Me.Caption, "cmdSave_Click")
-
-
End If
-
End Sub
-
-
-
Public Function SaveMode()
-
'On Public Function SaveMode()
-
If Mode = "Add" Then
-
' To Get ReqNo from Mslastdoc
-
Dim Rs As New ADODB.Recordset
-
If Rs.State = adStateOpen Then Rs.Close
-
Rs.Open ("SELECT * FROM MsLastDoc where YY ='" & FinancialYear & "'"), Db, adOpenKeyset, adLockPessimistic
-
txtId.Text = Rs("LastDocNo").Value + 1
-
Rs.Close
-
' End
-
-
' Save LastDoc
-
Dim LastDoc As New ADODB.Recordset
-
Dim DocNo As Integer
-
DocNo = Val(txtId.Text)
-
If LastDoc.State = adStateOpen Then LastDoc.Close
-
LastDoc.Open ("Select * From MsLastDoc where YY ='" & FinancialYear & "' "), Db, adOpenKeyset, adLockPessimistic
-
Db.Execute "Update MsLastDoc set LastDocNo ='" & DocNo & "' where YY ='" & FinancialYear & "' "
-
' End Save
-
End If
-
-
Call SaveAddress
-
Call ClearControl
-
-
End Function
-
Public Function SaveAddress()
-
Db.Execute " Delete from Adress where Id = '" & txtId.Text & "' "
-
-
Dim RsAddress As New ADODB.Recordset
-
'If RsReqHdr.State = adStateOpen Then RsReqHdr.Close
-
RsAddress.Open ("Address"), Db, adOpenKeyset, adLockPessimistic
-
With RsAddress
-
RsAddress.AddNew
-
.Fields("Id") = Val(txtId.Text)
-
.Fields("Addressof") = Val(cmbadrof.Text)
-
.Fields("Address") = Val(txtAddress.Text)
-
.Fields("city") = Val(txtCity.Text)
-
.Fields("Pin") = Val(txtPin.Text)
-
.Fields("entrydt") = Format(DTPentrydt, "DD-MMM-YYYY")
-
.Fields("closedt") = Format(DTPClosedt, "DD-MMM-YYYY")
-
-
.Update
-
End With
-
RsAddress.Close
-
End Function
-
Jun 16 '08
14 3692
Hi Veena..
That Code is not working in my project... my add function is this
Private Sub FormUpdateSQL1_ AddClick()
cmbadrfor.Enabl ed = True
'txtId.Text = GetNextCode("Ad dress", "AdrID")
cmbadrfor.Enabl ed = True
txtId.Enabled = False
ChkInd.Value = 1
End Sub
tht part of the code is not working in my function... wht else i can do..
thanks a lot
QVeen72 1,445
Recognized Expert Top Contributor
Hi,
you are using VB6 or VBA....?
My code is for VB6
Regards
Veena
I m using VB6 with SQLserver 2000
QVeen72 1,445
Recognized Expert Top Contributor
Hi,
Did you add the Function what I said in My previous post..?
Yes i added tht function the same way u told me but it is not working and still getting error
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: PK |
last post by:
Hello,
I am looking for help on the following. I'm trying to create a custom
browser toolbar button that will do a few things. One that I'm trying
to do at the moment is just simply return the URL of whatever page the
user is visiting.
I wanted to create a Win32 application using VB.NET. If there is a
better way of doing this please let me know. I assume there needs to
be some sort of client side code. I was originally leaning...
|
by: jbbs |
last post by:
I have a question regarding on the button and label.
i don't know why when the mouse cursor points on the button, i see the button is flirking. is there anyway to make it not behave like that?
because i want to highlight the text above the button when i click on it.
can anyone help me out . Thank You
the code is following:
############################################
# File: toolbar1.py
|
by: Lauren Quantrell |
last post by:
I use the following code to create text edit fields and command buttons
in my toolbars:
Function CreateToolbarObject(myObjectType as integer)
Dim newObject
Select Case myObjectType
Case 1 'text
Set newObject =
|
by: IntraRELY |
last post by:
I am using the following command to launch and .NET VB Executable, which is
a simple Windows Form (printCheckClient.exe). I am using a HyperLink Control
and works perfect.
hlPrintChecks.NavigateUrl = "javascript:var newWindow
=window.open('printCheckClient.exe',
1,'height=350,width=350,menubar=no,status=no,toolbar=no')"
I want to use a standard ASP.NET Button, but not sure what method to use. Is
there a way to accomplish this. I may not...
|
by: jake |
last post by:
How do you get or save a file from/to a client (button on web page) once
they are authenticated? The client could be Mac, Linux or Windows. Can I do
it all with IIS and ASP.NET?
| |
by: Mark Goldin |
last post by:
I have a toolbar on my form.
How do I know what button was clicked?
|
by: reidarT |
last post by:
I have entered a BindingNavigator toolbar in a bound form and can manage to
browse records and I am able to enter data in a new record.
I am ot able to save the data and therefore I have entered the save-button.
How do I code this button to save a new record?
reidarT
|
by: Angus |
last post by:
I have a web page with a toolbar containing a Save button. The Save
button can change contextually to be a Search button in some cases.
Hence the button name searchsavechanges.
The snippet of html is:
<a class="searchsavechanges btn btn3d tbbtn" href="javascript:"
style="position:static">
<div id="TBsearchsavechanges">Search</div>
</a>
|
by: manjesh |
last post by:
hi ,
kindly help to create a toolbar with that new , save , edit, cancel button ,
if i open each form to operate this buttons ,instead of placing in each form .
regards
manjesh
|
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...
|
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,...
| |
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...
|
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,...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |