QVeen72 104 Posting Shark

Hi,

Change this line:

Dim search1 As String = "'%" & string1 & "%'"

Keep a BreakPoint on this line... "cmd.CommandText"
and check the SQL Query...

Regards
Veena

QVeen72 104 Posting Shark

Hi,

Write this in Form1's button click event:

Form2.Lable1.Caption = "<My Caption>"

Regards
Veena

QVeen72 104 Posting Shark

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

QVeen72 104 Posting Shark

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

QVeen72 104 Posting Shark

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

saat.kerkuklu commented: Getting same error :( +0
QVeen72 104 Posting Shark

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

AndreRet commented: exactly! Well demonstrated... +13
QVeen72 104 Posting Shark

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

QVeen72 104 Posting Shark

Hi,

Change the property Setting for ListView:
LabelEdit = 1 -lvwManual

Regards
Veena

TnTinMN commented: yep +8
QVeen72 104 Posting Shark

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

QVeen72 104 Posting Shark

Hi,

or else, LostFocus of Text1, write this code:

Text1.Text = StrConv(Text1.Text, vbProperCase)

and check for "Red"

Regards
Veena

debasisdas commented: short and simple answer +13
QVeen72 104 Posting Shark

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

johncornelius23 commented: I'm still having an error +0
QVeen72 104 Posting Shark

Hi,

You have to use "%" around the text like this....

rs.Open "select * from books where title like '%" & Text12 & "%' ", cnn, adOpenStatic, adLockPessimistic

Regards
Veena

QVeen72 104 Posting Shark

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

QVeen72 104 Posting Shark

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

Skate Bart commented: OMG!!! thank you sooo much! It works. Jsut have to tweak the rest of the code.... thnx a lot!! =P +0
QVeen72 104 Posting Shark

Hi,

Just call the second form Modal:
Write this in MainForm:

frmChild.Show 1

Regards
Veena

ulrichrandom commented: thank you very much. cheers! +0
QVeen72 104 Posting Shark

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

QVeen72 104 Posting Shark

Hi,

Use "MkDir"

MkDir "C:\MyNewFolder"

before that, you need to make sure, the folder does not exist

Regards
Veena

QVeen72 104 Posting Shark

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

QVeen72 104 Posting Shark

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

chuckjessup commented: It worked and i nolonger want to go postal on my computer... +1
QVeen72 104 Posting Shark

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

QVeen72 104 Posting Shark

Hi,

If you already have dataenvironment and connection, then try this :

DataEnvironment1.Connection1.Execute strSQL

Change dataEnvironment and connection names accordingly..

Regards
Veena

Israelsimba commented: this person is a gem for sure. one who knows stuff...keep it up +1
QVeen72 104 Posting Shark

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

xfrolox commented: For helping me 1 reputation point :) +1
QVeen72 104 Posting Shark

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

QVeen72 104 Posting Shark

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

jbisono commented: Really helpful comments. +1
QVeen72 104 Posting Shark

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

Comatose commented: Very Well Done. +8
QVeen72 104 Posting Shark

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

nor_d83 commented: always trying to help +1
QVeen72 104 Posting Shark

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

Comatose commented: Nice Code +8
QVeen72 104 Posting Shark

Hi,

Index should be the Index name and not the Fieldname..

Data1.Recordset.Index = "indStatus"

Regards
Veena

QVeen72 104 Posting Shark

Hi,

Try this :
Report.Printout False

Without vieiwng the report..

Regards
Veena

jaasaria commented: thhx for helping in printing without any view.. thxxx +2
debasisdas commented: agree +13
QVeen72 104 Posting Shark

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

ITech commented: very good touch in vb +1