singoi 0 Newbie Poster

No problem..resolved

Private Sub wazopen_Click()

Dim myfol As String
Dim myfln As String
Dim myfpath As String
Dim PA As String
Dim AcrobatReader As String
AcrobatReader = "C:\Programme\Adobe\Reader 9.0\Reader\AcroRd32.exe "
myfol = "C:\Dokumente und Einstellungen\singava\Eigene Dateien\Eigene Bilder\T_online Rechnungen\"
myfln = Me.txtwaz
myfpath = myfol & myfln

PA = AcrobatReader & myfpath
Shell PA, vbNormalFocus

End Sub

singoi 0 Newbie Poster

Hi friends,

i have a textbox where i have a path of the pdf file. now after pressing a cummand button i want this file to be opened.

my code is as follows..

Private Sub wazopen_Click()
Dim myfol As String
Dim myfln As String
Dim myfpath As String

myfol = "C:\Dokumente und Einstellungen\singava\Eigene Dateien\Eigene Bilder\T_online Rechnungen\"
myfln = Me.txtwaz
myfpath = myfol & myfln
Application.FollowHyperlink myfpath

End Sub

but i am getting an error here..permission denied...

is there any method where i can open this pdf file taking the path from a textbox.

Thanks friends

singoi 0 Newbie Poster

Hi Friends,

how can i change the color of a cell when Datagrid cell is cliked and also this color should be saved in Access database on the same cell.

Thx - singoi

singoi 0 Newbie Poster

Hi friends,
i got a frame with Listview which shows all the records from access table with duplicate BANF nrs.like u see in first pic BANF nrs 1 and 2

BANF Nr 1 BANF Nr 2
ID NAME ID NAME
1 MARKUS 1 INGO
2 SHEELA 2 WEBER
3 ROHIT 3 HALLO
4 ANDREAS 4 ALI
5 TULIP

so i have to get no Duplicate BANF Nrs in this first pic LISTVIEW(lst1)
now when i click the BANF Nr in lst1 and press OPEN button then open second form with listview lst2 where in i need to show all the details of BANF Nr 2.

i hope u got my point..how can i write the code for this..please help me friends.

singoi 0 Newbie Poster

Hi Freinds,
I feel secured seeing some responses for my problem.

i am attaching few more pics.

1st Pic is BANF_Nr table where only BANF_Nr is recorded.
2nd Pic is another table with described BANF_Nr where each BANF consists of number of position numbers.

3rd Pic shows the two Tables in database

4rd Pic which is a Form with Listview (lst1) top one and Listview (lst2) bottom one. when i click this Open Button these two Listviews get enabled and lst1 shold show only BANF_Nr from Table BANF_Nr

and lst2 should get enabled and show the detailed BANF_Nr from second Table.

5th Pic shows the Formfor Neu BANF Commandbutton.. this should get activated with continued BANF_Nr like BANF-0005 becoz there already exists BANF-0004. and then lst2 should be enabled with empty records for this BANF-0005. when i press this Button Einfügen then the records for BANF-0005 will be recorded in database and be shown here in this lst2

i hope u got an idea ..

now the code i have written

in Module:
Public Conn As New ADODB.Connection
Public Connection As New ADODB.Connection
Public rs As New ADODB.Recordset
Public recordset1 As New ADODB.Recordset
Public recordset2 As New ADODB.Recordset
Public command As New ADODB.command
Public Gender As String

Public Function ConnectADO()

Set Conn = New ADODB.Connection
Set rs = New ADODB.Recordset

Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source= " & App.Path & …

singoi 0 Newbie Poster

Hi Freinds,
a Complicated situation for me.

i Have a 2 tables in access with the same Field saying BANF_Nr which sees like " -BANF-0001"
here this 0001 is an Autonumber like 0001,0002,0003,0004 and so on

i have a textbox in Form txtbanf which should call automatically the next number from this field..suppose there is BANF-0028 the last ones..now when i go to this form the txtbanf.text should be automatically filled by BANF-0029.

this BANF-0029 should not get saved unless i click the button SAVE.

i tried to attach some jpeg files for your convinience but couldnt..

Please help me friends in getting this code..

Thx

singoi 0 Newbie Poster

First initialize all text boxes from txt1 to txt7 = ""
Then get the data from table using a query for sum of Stunden for different Taetigkeit and populate the textboxes.

Private Sub Combo1_Click()

    Dim rs As New ADODB.RecordSet

    On Error GoTo Combo1_Click_Error

    'This statement calls the Procedure to clear the textboxes.
    Call ClearTextBoxes

'Open the recordset where ProjektNr is 
'equal to the ComboBox Selection
'Here con is the Database Connection Object I have used.
'U have to replace with the one which u r using

    rs.Open " SELECT STUNDEN.Taetigkeit, SUM(STUNDEN.Stunden) as TotStunden FROM STUNDEN WHERE STUNDEN.ProjektNr = '" & Combo1.Text & "' GROUP BY STUNDEN.Taetigkeit ", con, adOpenKeySet, adLockReadOnly

    While Not rs.EOF()
        Select Case rs!Taetigkeit
                Case "Technische Bearbeitung"
                    txt1.Text = rs!TotStunden
                Case "CAD Erstellungen"
                    txt2.Text = rs!TotStunden
                Case "Berechnungen"
                    txt3.Text = rs!TotStunden
                Case "Besprechung"
                    txt4.Text = rs!TotStunden
                Case "Verwaltung"
                    txt5.Text = rs!TotStunden
                Case "Bauleitung"
                    txt6.Text = rs!TotStunden
                Case "Montage"
                    txt7.Text = rs!TotStunden
        End Select
        rs.MoveNext
    Wend
    If txt1.Text = "" then txt1.Text = "0"
    If txt2.Text = "" then txt2.Text = "0"
    If txt3.Text = "" then txt3.Text = "0"
    If txt4.Text = "" then txt4.Text = "0"
    If txt5.Text = "" then txt5.Text = "0"
    If txt6.Text = "" then txt6.Text = "0"
    If txt7.Text = "" then txt7.Text = "0"


Combo1_Click_Done:
    If Not rs Is Nothing Then If rs.State then rs.Close
    Set rs = Nothing
    Exit Sub

Combo1_Click_Error:
    MsgBox Err.Number & " : " & Err.Description
    Resume Combo1_Click_Done

End Sub

'This function is to clear the …
singoi 0 Newbie Poster

Hallo friends,
need help for following problem.

i have a form where i get the details of particular Combobox. Pic 2.jpg attached. here on right side i got few textboxes say txt1..txt2 .... txt7.

on left side of this jpg i got the details of a particular project number.

when you see 3.jpg its an access table with details of different projects. under taetigkeit field there are different fields with corresponding values for Stunden field.

now when i select a particular Project to show me the details this 2.jpg form appears with all the details corresponding to this project.
now i need the total stunden for each taetigkeit to be calculated and fill these txt1 txt2....so on till txt7. these txt1 till txt7 are these taetigkeit.

ex. ProjectNr : TR36
txt1 should be = 9
txt2 = 6
txt3 = 3
txt4 = 0 coz there are no Stunden for this field
txt5 = 12
txt6 = 0
txt7 = 0

please friends..need help for this..
how does this syntax looks like for commandbox click event.

thanks-singoi

singoi 0 Newbie Poster

Hi Friends,

how can i change the columns width in MSflexgrid by code from 1.jpg to 2.Jpg

I have copied this code in my Module:


Public Function Grid_AutoSize(oGrid As MSFlexGrid, oLabel As Label)
  Dim nRow As Long
  Dim nCol As Long
  Dim nWidth As Long
  Dim nMaxWidth As Long
 
  ' Setzen der Eigenschaften
  With oLabel
    With .Font
      .Name = oGrid.Font.Name
      .Size = oGrid.Font.Size
      .Bold = oGrid.Font.Bold
      .Italic = oGrid.Font.Italic
      .Strikethrough = oGrid.Font.Strikethrough
      .Underline = oGrid.Font.Underline
    End With
 
    ' Wichtig!
    .WordWrap = False
    .AutoSize = True
  End With
 
  ' Auswerten und Setzen der Grössen
  With oGrid
    For nCol = .FixedCols To .Cols - 1
      nMaxWidth = 0
      For nRow = .FixedRows To .Rows - 1
        oLabel.Caption = .TextMatrix(nRow, nCol)
        nWidth = oLabel.Width
        If nWidth + 100 > nMaxWidth Then nMaxWidth = nWidth + 100
      Next nRow
 
      .ColWidth(nCol) = nMaxWidth
    Next nCol
  End With
End Function

and i have called this function in my Form Load

Grid_AutoSize msf1, lbltemp

Dim m As Long
For m = 1 To msf1.Cols + 1
  msf1.ColWidth(-1) = 1400
Next

can u please help me

Thanks,

Singoi

singoi 0 Newbie Poster

Hallo Friends,

I need some help from you.

i am hereby attaching some files of my project. in 1.jpeg after clicking add button the data will be automatically written in access table shown in 2.jpeg.

this is the code for add button.
-----------------------------------------------------------------------------------------
Private Sub cmdadd_Click()

Dim db As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim ss As New ADODB.Recordset
Dim tt As New ADODB.Recordset
Dim sConn As String

Dim cnt As Long
Dim tmp As String

cmdadd.Enabled = False
cmdcnc.Enabled = False
cmdclear.Enabled = True

For cnt = 1 To 100000

ProgressBar1.Visible = True
ProgressBar1.Value = cnt

'needed to trap cancel click
DoEvents

Next

'ProgressBar1.Value = 100000
ProgressBar1.Visible = False
lblpro.Visible = True

Dim sPath As String
sPath = "C:\Dokumente und Einstellungen\singava\Eigene Dateien\Eigene Programme\projekt.mdb"

sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sPath
db.ConnectionString = sConn
db.Open
rs.ActiveConnection = db
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset

ss.ActiveConnection = db
ss.LockType = adLockOptimistic
ss.CursorType = adOpenKeyset


tt.ActiveConnection = db
tt.LockType = adLockOptimistic
tt.CursorType = adOpenKeyset


rs.Open "Projekt" '** tableName is ur table

rs.MoveFirst
'If rs.EOF = True Then

rs.AddNew
rs.Fields.Item(1) = txtbn.Text
rs.Fields.Item(2) = txtdt.Text
rs.Fields.Item(3) = txtldt.Text
rs.Fields.Item(4) = txtpn.Text
rs.Fields.Item(5) = txtbb.Text
rs.Fields.Item(6) = txtst.Text
rs.Fields.Item(7) = txttb.Text