• WSClausParkhoi

    WSClausParkhoi

    @wsclausparkhoi

    Viewing 11 replies - 76 through 86 (of 86 total)
    Author
    Replies
    • in reply to: when is a listbox not selected ? (access97) #563717

      By the way. Why don’ t you consider using a combobox as a substitute for the txtBox and the publishers listbox? I have attached a small sample (ver. 97)

    • in reply to: Multi-select List Box (A97) #563778

      I would have created a registration form based on the class table (tblClass?) and a subform based on tblClassRegistrations. In the subform (or even in the tabledefinition for tblClassRegistrations) select the individual to register via a combobox. No VB coding needed.

      If for some reason you don’t want to do that, something like this should work:

      Assumptions:
      The bound column in lstBoxB has the StudentID.
      StudentID is defined in the tblClassRegistrations table.
      The primary key in tblClassRegistrations is an autonumber (e.g. RegistrationID).
      The name of the ClassID control on the form is txtClassID.

      Create a DoubleClick event in listbox B having the following code:

      Private Sub lstBoxB_DblClick(Cancel As Integer)
      on Error goto ErrHdl
      dim rst as recordset
      set rst=currentdb.openrecordset(“tblClassRegistrations”)
      rst.add
      rst!ClassID=txtClassID
      rst!StudentID=lstBoxB ‘ Assume Student is the bound column
      rst.update
      rst.close
      lstBoxA.Requery ‘ Update the list of reg’ed students
      Xit:
      exit sub
      ErrHdl:
      msgbox Err.description
      resume Xit
      End Sub

    • in reply to: when is a listbox not selected ? (access97) #563716

      In order for you to use the Click event you must set the value of the listbox – selecting the correct row is not sufficient.

    • in reply to: when is a listbox not selected ? (access97) #563704

      How did you code the textbox and the first listbox together ? And how do you move down the publishers listbox ?

    • in reply to: when is a listbox not selected ? (access97) #563689

      Why are you talking about default values?
      To make it work you would have to use the textbox AfterUpdate event to assign a value to the publishers listbox corresponding to the publisher, and then call the Click event (publishers listbox) in order to fill the publications listbox, assuming you are using this to fill the publications listbox.

    • CurrentDb.Properties(“AccessVersion”) will return the Acces version (not the Office version).

    • in reply to: Full-size Preview? (AXP 10.2627.2625) #563377

      You may want to place the DoCmd.Maximize stmt right after your DoCmd.OpenReport. Then you don’t have to put code in the report.

    • in reply to: data integrity (Access 97 / Win.98) #563264

      The very simple solution to your problem would be to create a PreviousPrice field (and may be even a DateChanged field) in your products table and copy the price on every change.
      A more advanced solution could be to create and maintain a separate ProductPriceHistory table.

    • in reply to: Need guidance autolinking tables (Office 97 SR2 win98) #563257

      To my understanding you have already established the 12 mmmyyProj dbs initialy having empty tables and in addition you have established a yyProj dbs.
      Assuming you have established links to the 12 mmmyyProj dbs tables in the yyProj dbs, all you have to do is to create a UNION query in the yyProj dbs in order to combine your monthly results. Then you do not have to worry about who will append data and when. The result will always be uptodate (uptomonth).
      As for Excel: bring your data into a sheet using a query. Create a query in Excel referencing the above mentioned query in the yyProj dbs.
      As I see it, you don’t have to do any VB programming in Excel or Access to do this job.

    • in reply to: easy question of the day (access97) #561376

      Try vbNewline for size

      I have two public constants always declared in my applications:

      Public Const cNl = vbNewLine
      Public Const c2Nl = cNl & cNl

      They are easier to type (if used often).

    • in reply to: Automation only works once (Access 2000) #560621

      Peter,
      I have spent some time solving your problem, and now find that you have managed your self. Congratulatins!
      I decided to post this anyway, since some of it might have your interest.

      Regards,
      Claus Parkhoi

      Here it is:
      I have done some changes to your code. The use of CentimetersToPoints was the
      cause of your trouble. I have changed all refs to: appWd.CentimetersToPoints(x).
      Furthermore I have made changes to attempt to use a running Wordapp by using
      Getobject instead of Createobject. If Word is not running, Err_Tryword will
      create the object for you and resume. This makes your function IsWordRunning
      redundant.
      I have tested it. It works. Happy New Year!
      PS. Why don’t you put appWD declaration in the sub – I would have.

      Public appWD As Word.Application ‘In the real code this is actually declared elsewhere

      Sub TryWord()
      Dim StrToInsert As String, FileName As String, Msg As String
      Dim blnWordWasRunning As Boolean
      Dim FlDt As Date
      On Error GoTo Err_TryWord
      ‘ ** remove blnWordWasRunning = IsWordRunning
      ‘ ** remove Set appWD = CreateObject(“Word.Application”)
      ‘ ** remove blnWordWasRunning = IsWordRunning
      ‘ insert next line
      Set appWD = GetObject(, “Word.Application”) ‘ Use existing app, if any
      FileName = “C:AAATemp.rtf”
      With appWD
      .Application.Visible = False
      .Documents.Add DocumentType:=wdNewBlankDocument
      With .Selection
      .Font.Name = “Arial”
      .Font.Size = 10
      StrToInsert = “Hope This works”
      .InsertAfter StrToInsert
      End With ‘.Selection
      With .ActiveDocument.PageSetup
      .Orientation = wdOrientLandscape
      .TopMargin = appWD.CentimetersToPoints(2)
      .BottomMargin = appWD.CentimetersToPoints(1.5)
      .LeftMargin = appWD.CentimetersToPoints(2)
      End With ‘ActiveDocument.PageSetup
      .Selection.ParagraphFormat.TabStops.ClearAll
      .ActiveDocument.DefaultTabStop = appWD.CentimetersToPoints(1.27)
      .Selection.ParagraphFormat.TabStops.Add Position:=appWD.CentimetersToPoints(2), _
      Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
      On Error Resume Next
      FlDt = FileDateTime(FileName)
      If Err.Number = 0 Then
      On Error GoTo Err_TryWord
      Msg = FileName & vbCrLf & “already exists.” & vbCrLf & _
      “Overwrite – [Yes] or save as Temp.rtf – [No}”
      If MsgBox(Msg, vbQuestion + vbYesNo) = vbNo Then
      FileName = “C:AAATemp2.rtf”
      End If
      End If
      On Error GoTo Err_TryWord
      .ActiveDocument.SaveAs FileName:=FileName, FileFormat:=wdFormatRTF
      .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
      ‘ ** you might remove the next line, since calling again
      .Quit
      End With ‘appWD
      Set appWD = Nothing
      FollowHyperlink FileName
      Exit_TryWord:
      ‘ ** remove the following lines
      ‘If blnWordWasRunning = False Then ‘| If word wasn’t already running
      ‘Do ‘| I

    Viewing 11 replies - 76 through 86 (of 86 total)