Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 3rd, 2006, 09:29 AM
Authorized User
 
Join Date: Apr 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

"PslTransList" represents a translation list. It offers methods to perform operations on the translation list and attributes to access each resource string.

--
Shailesh



 
Old July 3rd, 2006, 09:31 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

If there are just two strings, then you shouldn't need the For Next loop. Just:

Rs1.AddNew
Rs1("Lemma") = trn(0)
Rs!.Update
Rs1.AddNew
Rs1("Lemma") = trn(1)
Rs1.Update

See, it looks like an Array to me.
Also, is this the table structure of the table you are going to:

Lemmas
Lemma - text


mmcdonal
 
Old July 3rd, 2006, 09:34 AM
Authorized User
 
Join Date: Apr 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's like:

Lemmas (Table Name)
Lemma (Feild name)
Source text ("means english Data")
Text ("means German Data")
Source text
Text

 
Old July 3rd, 2006, 09:41 AM
Authorized User
 
Join Date: Apr 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's an Object --PslTransList--

Methods:

AutoTranslate ----- Auto translation

Close ----- Closes the translation list

DecorateText ----- Adds additional leading or trailing characters to Text

Export ----- Exports the translation list

ExportDate ----- Returns the time of the export, if the translation list is exported.

ExportFile ----- Returns the path of the translation bundle, if the translation list is exported.

FileDate ----- Returns the the time stamp of the target file.

FindID ----- Returns a source string with a given ID

GenerateTarget ----- Generates the target file

GetStatistics ----- Returns the statistics for the translation list

Import ----- Imports a translation list

LastChange ----- Returns the the date and the time when this translation list has last been changed.

LastGeneration ----- Returns the the date and the time when the target file has last been generated.

LastUpdate ----- Returns the the date and the time when this translation list has last been updated.

Open ----- Opens the translation list

Properties ----- Returns all custom properties of the translation list

Property ----- Returns or sets a single custom property of the translation list

Save ----- Saves the translation list

ScanTargetFile ----- Scans a target file for translations

SimulateTranslation ----- Generates the target file with simulated translations

TranslateText ----- Translation for one string

UndecorateText ----- Removes additional leading or trailing characters from Text

Update ----- Creates or updates the translation list


Properties:

IsOpen True, ----- if the translation list is open

Language ----- Returns the target language as a PslLanguage object

ListID ----- Returns the numerical ID of the string list

Project ----- Returns the project object

Resource ----- Returns a resource object

ResourceCount ----- Returns a resource count

SourceList ----- Returns the source list object

StringCount ----- Returns a string count

String ----- Returns a string

TargetFile ----- Target file for the translation



 
Old July 3rd, 2006, 09:48 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I'm sorry but you will need to dumb it down a little for me.

What is the final format of the data that you are getting? I understand where you want to put it, but I am not sure how to grab it. Is it one string, two strings, many strings, etc? Can you show me what the output of the "PslTransList"

mmcdonal
 
Old July 3rd, 2006, 10:04 AM
Authorized User
 
Join Date: Apr 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Basically is the software localization software, where *.exe, *.dll ,*.res can be localized.

Below code is the access to the string list from the editor, as i am using the VBA Macro within Passolo.

Code:
 Dim trn As PslTransList
  Set trn = PSL.ActiveProject.TransLists(1)
  If trn Is Nothing Then Exit Sub
In Passolo Editor view, the Resource List looks like:


English German
Invalid Currency. Ungültige Währung.
Invalid DateTime. Ungültiges Datum oder ungültige Zeit.
Invalid DateTimeSpan. Ungültige Datums- oder Zeitspanne.
Invalid filename. Ungültiger Dateiname.
Failed to open document. Fehler beim Öffnen des Dokuments.
Failed to save document. Fehler beim Speichern des Dokuments.

it's goes on.......




 
Old July 3rd, 2006, 10:15 AM
Authorized User
 
Join Date: Apr 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Same thing I did instead of using MS Access I have used Excel. I am getting the required output.
Below is the macro and the output for the same.....


Macro:

Sub Main
    ' Get a translation list
  Dim trn As PslTransList
  Set trn = PSL.Projects(1).TransLists(1)
  If trn Is Nothing Then Exit Sub

' Open Excel and create a workbook

  Dim ex As Object
  Set ex = CreateObject("Excel.Application")


Dim wb As Object
  Set wb = ex.Workbooks.Add
  ' Add soure strings, translated string and descriptions



Dim j As Long
Dim i As Long
  For i = 1 To trn.StringCount
  j = 2*i
    With wb.ActiveSheet
      .Range("a" & CStr(j - 1)) = trn.String(i).SourceText
      .Range("a" & CStr(j)) = trn.String(i).Text
      '.Range("c" & CStr(i)) = trn.String(i).Description
    End With
  Next i
  ex.Visible = True
  MsgBox("Click to close Excel")
  ex.Quit

End Sub

Output:

    Column A
Invalid Currency.
Ungültige Währung.
Invalid DateTime.
Ungültiges Datum oder ungültige Zeit.
Invalid DateTimeSpan.
Ungültige Datums- oder Zeitspanne.
Invalid filename.
Ungültiger Dateiname.
Failed to open document.
Fehler beim Öffnen des Dokuments.
Failed to save document.
Fehler beim Speichern des Dokuments.

So the same format i need in Access Database.




 
Old July 3rd, 2006, 10:17 AM
Authorized User
 
Join Date: Apr 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The same thing I did in Excel:
Below is the Macro:....
Sub Main
    ' Get a translation list
  Dim trn As PslTransList
  Set trn = PSL.Projects(1).TransLists(1)
  If trn Is Nothing Then Exit Sub

' Open Excel and create a workbook

  Dim ex As Object
  Set ex = CreateObject("Excel.Application")


Dim wb As Object
  Set wb = ex.Workbooks.Add
  ' Add soure strings, translated string and descriptions



Dim j As Long
Dim i As Long
  For i = 1 To trn.StringCount
  j = 2*i
    With wb.ActiveSheet
      .Range("a" & CStr(j - 1)) = trn.String(i).SourceText
      .Range("a" & CStr(j)) = trn.String(i).Text
      '.Range("c" & CStr(i)) = trn.String(i).Description
    End With
  Next i
  ex.Visible = True
  MsgBox("Click to close Excel")
  ex.Quit

End Sub


And the output for the same is:

Column A

Invalid Currency.
Ungültige Währung.
Invalid DateTime.
Ungültiges Datum oder ungültige Zeit.
Invalid DateTimeSpan.
Ungültige Datums- oder Zeitspanne.
Invalid filename.
Ungültiger Dateiname.
Failed to open document.
Fehler beim Öffnen des Dokuments.
Failed to save document.
Fehler beim Speichern des Dokuments.

The same output i need in MS Access Database.

--
Shailesh

 
Old July 3rd, 2006, 10:18 AM
Authorized User
 
Join Date: Apr 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry for multiple post?

 
Old July 3rd, 2006, 10:50 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Okay, I see what you are doing.
I think you want one record, though, and not a column of data as in Excel. So your table would be:

Lemmas
SourceText - Text
Text - Text

Then you want to populate this with the call from Passolo.

Is that correct?

If so, then you would do this:

x = 0
For x = 0 To trn.StringCount
   Rs1.AddNew
   Rs1("SourceText") = trn.String(x).SourceText
   Rs1("Text") = trn.String(x).Text
   Rs1.Update
   x = x + 1
Next

This will keep creating records one row at a time, and each row will have two fields, not one. One field will have Source Text, and the other Text.

Does this work?


mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding row to dataset in C# MAKO C# 2 March 11th, 2010 08:10 AM
Adding a row without using Update command wpyoung2600 ADO.NET 1 August 22nd, 2004 08:26 AM
Adding a button to each row of a datagrid badgolfer ASP.NET 1.0 and 1.1 Basics 1 March 1st, 2004 10:05 AM
Dynamically adding a row to a DataGrid vwindrow ASP.NET 1.x and 2.0 Application Design 2 August 20th, 2003 03:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.