Hi,
Change this line:
Dim search1 As String = "'%" & string1 & "%'"
Keep a BreakPoint on this line... "cmd.CommandText"
and check the SQL Query...
Regards
Veena
Hi,
Change this line:
Dim search1 As String = "'%" & string1 & "%'"
Keep a BreakPoint on this line... "cmd.CommandText"
and check the SQL Query...
Regards
Veena
Hi,
Write this in Form1's button click event:
Form2.Lable1.Caption = "<My Caption>"
Regards
Veena
Hi,
if you are using SQL Express...
You need to mention location of the mdf file...
try this :
Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;
Trusted_Connection=Yes;
Regards
Veena
Hi,
To use trusted Connection, you should have logged in Windows using Administrator login..
For other users, it may not work, until privileges are given...
Create user in SQL Server, and give access to the user.. use that userID and pwd in your connstring..
Server=myServerAddress;Database=myDataBase;Uid=myUsername; Pwd=myPassword;
Regards
Veena
Hi,
You are getting the error, because, you have not populated the connection string for the connection... call the function getConnect.. and open the connection...
Connect.GetConnect()
Conn.Open()
Regards
Veena
Hi,
In that case, you need to query like this:
use AndreRet's code... Modify that sql query this way.... use Month() ...
rs.Open "Select * from Dailyrecord where Month(purchase_date) = " _
& Combo1.ItemData(Combo1.ListIndex) , acd, adOpenForwardOnly
Fill the Combo Using this Code:
Combo1.Clear
Combo1.AddItem "January"
Combo1.ItemData(Combo1.NewIndex) = 1
Combo1.AddItem "February"
Combo1.ItemData(Combo1.NewIndex) = 2
'
......... For all months..
Combo1.AddItem "December"
Combo1.ItemData(Combo1.NewIndex) = 12
Regards
Veena
Hi,
What you can do is.. Add one more ListBox, and add all the names from database into that list box..
In Change event of combobox, clear combobox.. and loop thru the Listbox, add items to combo box with like condition...
Regards
Veena
Hi,
Change the property Setting for ListView:
LabelEdit = 1 -lvwManual
Regards
Veena
Hi,
First Line, Declare RS as New..
20th Line, remove Exit Sub
and no need of ADO.. DataControl..
Check the modified code:
Private Sub Command2_Click()
Dim rs1 As New ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim sTrID As String
Dim Total As Integer
Dim xhours As String
Dim Intime As String
Dim Outtime As String
'
sTrID = txtSearch.text
Set rs = Nothing
rs.Open "Select Count(DateIn) as Total from Time_In where Employees_IdNo = '" & sTrID & "'", Cn, adOpenKeyset, adLockPessimistic
If Not rs.EOF Then
lblTotal_Days.Caption = rs!Total
rs.Close
Set rs = Nothing
rs.Open "Select Employees_IdNo, DateIn, TimeIn, TimeOut from Time_In where Employees_IdNo = '" & sTrID & "'", Cn, 2, 3
If Not rs.EOF Then
Intime = rs!TimeIn
Outtime = rs!TimeOut
xhours = Timediff(Intime, Outtime)
set rs1 = Nothing
rs1.Open "Select Sum([xhours])as totalxhours from Time_In where Employees_IdNo = '" & sTrID & "'", cn, 2, 3
If Not rs1.EOF Then
lblTotal_Hours.Caption = rs1!totalxhours
End If
rs1.Close
Set rs1 = Nothing
rs.Close
Set rs = Nothing
End If
Else
MsgBox "No records found! ", vbExclamation, "DailyRecords"
End If
End Sub
Public Function Timediff(ByVal time1 As String, ByVal time2 As String) As String
Dim MinsDiff, TheHours As String
MinsDiff = DateDiff("n", time1, time2)
MinsDiff = IIf(MinsDiff < 0, MinsDiff + 1440, MinsDiff)
TheHours = Format(Int(MinsDiff / 60), "00")
MinsDiff = Format(MinsDiff Mod 60, "00")
Timediff = TheHours & ":" & MinsDiff
End Function
Regards
Veena
Hi,
or else, LostFocus of Text1, write this code:
Text1.Text = StrConv(Text1.Text, vbProperCase)
and check for "Red"
Regards
Veena
Hi,
Change the code to:
Dim RS As New Adodb.Recordset
Dim con As New Adodb.Connection
Private Sub mygdb()
Set con = New Adodb.Connection
con.CursorLocation = adUseClient
con.Open "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source =" _
& App.Path & "\enrolment.mdb;"
End Sub
Regards
Veena
Hi,
You have to use "%" around the text like this....
rs.Open "select * from books where title like '%" & Text12 & "%' ", cnn, adOpenStatic, adLockPessimistic
Regards
Veena
Hi,
Yes, as Chris above said, If [Tour ID] is a numeric field, then you should not wrap it with single quotes....
strSQL = "Delete From Tour Where [Tour ID]=" & Val(fgdTour.TextMatrix(fgdTour.Row,1))
Regards
Veena
Hi,
Your Code always delees first record.. as you have not used a "Where" condition in your recordset... Instead of that, run the "delete" command, and refresh the grid..
something like this:
strSQL = "Delete From Company Where [Company Name] = '" _
& fgdCompany.TextMatrix(fgdCompany.Row, 1) & "'"
Cn.Execute strSQL
strSQL = "Select * From Company"
rsCompany.Open strSQL, cn, adOpenStatic, adLockPessimistic
Set fgdCompany.DataSource = rsCompany
Note: Assuming Company Name is displayed in Column 1 of flex grid... change accordingly
Regards
Veena
Hi,
Just call the second form Modal:
Write this in MainForm:
frmChild.Show 1
Regards
Veena
Hi,
In report, if "Convert Null To Defaults" setting is ON, then you have to check like this :
Report.RecordSelectionFormula = "totext({Prescriptions.RecDateR}) = ''"
Regards
Veena
Hi,
Use "MkDir"
MkDir "C:\MyNewFolder"
before that, you need to make sure, the folder does not exist
Regards
Veena
Hi,
When you have opened recordset with multiple tables, the Recordset becomes ReadOnly.. What you have to do is open a DAO's Database Object and Run SQL Update Queries.. something like this :
Dim DB As Database
Dim i As Integer
Dim sSQL as String
Set DB = OpenDatabase(App.Path & "\data.mdb")
For i = 1 To Grd.Rows- 1
sSQl = "UpDate MyTable Set myFld = " & Grd.TextMatrix(1,4) _
& " Where Fld1 = '" & Grd.TextMatrix(1,1) & "' And Fld2 ='" _
& Grd.TextMatrix(1,2) & "'"
DB.Execute sSQL
Next
DB.Close
Change Field/Table Column Names accordingly..
Regards
Veena
Hi,
the Syntax, you have used to Declare the DLL is not for UserCreated DLL's, It is for WINAPI's..
OK, First Create the DLL and Compile IT.
Then, Go to your Calling Project, open References, and Add the DLL, If the dll is not present in the list, add By Browsing to the folder...
And To Use the DLL,
Declare the Class :
Dim MyCls As New TCP
use the Procedure like this :
Call MyCls.FileEncodeAndDecode(....
Regards
Veena
HI,
WITH WHAT FIELD IS THE "lstsoftware12" POPULATED...?
YOU CANT GIVE SAME CREITERIA for all the where conditions in SQL Query......
Why not post the table structure as well (even if it is simple...)....
Usually in such conditions.. you will need to have as many selection ListBoxes as much as in Where condition...
WindowsListBox, OfficeListBox, AutoCADListBox etc.....
and each of them populated with their respective fields seperately...
In your design, you are having only one listbox ... which will not work
Regards
Veena
Hi,
If you already have dataenvironment and connection, then try this :
DataEnvironment1.Connection1.Execute strSQL
Change dataEnvironment and connection names accordingly..
Regards
Veena
Hi,
Try This :
TextBox1.Text = TextBox1.Text & Chr(13) & "New Text"
OR
TextBox1.Text = TextBox1.Text & vbCrLF & "New Text"
Note: Multiline should be True for the Textbox..
Regards
Veena
Hi,
First shift all the procedures to the "Class" object.(say MyClass)
and in calling form, use this code:
Dim TCls As New MyClass
Dim TempName as String
TempName="AAA"
CallByName(TCls, TempName, CallType.Method)
TCls = Nothing
Regards
Veena
Hi,
Why do you want to use "AppendChunk" for simple string..?
Try This :
nVNBR = "hi how are yodsf sdf"
rsVen("BITS") =nVNBR
rsVen.Fields("BITS_LENGTH") = 19
' Or
' rsVen.Fields("BITS_LENGTH") =Len(nVNBR)
rsVen.Update
Regards
Veena
Hi,
Declare this API at the top :
Private Declare Function SHGetFolderPath Lib "shfolder.dll" _
Alias "SHGetFolderPathA" _
(ByVal hwndOwner As Long, _
ByVal nFolder As Long, _
ByVal hToken As Long, _
ByVal dwReserved As Long, _
ByVal lpszPath As String) As Long
to Get the path :
Dim MyPath As String
MyPath = Space(260)
Call SHGetFolderPath(Me.hWnd, 0, -1, &HC, MyPath)
MsgBox MyPath
Regards
Veena
Hi,
Yes, Little bit tweaking of my code, will do the job:
Dim i As Integer
Dim TAmt As Currency
TAmt = 0
For i = 1 To Grd.Rows-1
TAmt = TAmt + Val(Grd.TextMatrix(i, 8))
Next
TAmt = Val(txtBudget.Text) - TAmt
txtBalance.Text = Format(Tamt,"0.00")
You can Call this In LostFocus Of txtBudget..
Regards
Veena
Hi,
Try This :
Dim i As Integer
Dim TAmt As Currency
TAmt = 0
For i = 1 To Grd.Rows-1
TAmt = TAmt + Val(Grd.TextMatrix(i, 8))
Next
TAmt = TAmt +Val(txtBudget.Text)
MsgBox "Total Amount Is : " & Format(TAmt, "0.00")
Change names of your controls, and Column accordingly..
REgards
Veena
Hi,
Index should be the Index name and not the Fieldname..
Data1.Recordset.Index = "indStatus"
Regards
Veena
Hi,
Try this :
Report.Printout False
Without vieiwng the report..
Regards
Veena
Hi,
After Selection of ComboBox, To filter out records use this query:
"Select CI.name,I.ServiceID,P.packagename,P.duration,P.price,I.date,I.timeIn,I.timeOut
From CustInfo CI, InDate I, PakInfo P Where CI.CustID = I.CustID And I.ServiceID = P.ServiceID And Month(I.Date) = " & (Combo1.ListIndex+1) & " Order By CI.Name"
Assuming, Your ComboBox is not sorted and it is in the Order "Jan","Feb","Mar"...
To Select Sum of price use this query:
"Select Sum(P.price)
From CustInfo CI, InDate I, PakInfo P Where CI.CustID = I.CustID And I.ServiceID = P.ServiceID "
Open recordset like above and populate the label..
Regards
Veena