Probably, yes. But we bypass the fact that we have to write to a cell, since
we can write a whole record directly to a table:
Dim mySQLcommand AS string
mySQLcommand = "INSERT INTO tableName( FieldSomeName, FieldSomeValue1,
FiedlSomeValue2, FiedSomeValue3) VALUES( """ & SomeName & """," &
someValue1 & "," & someValue2 & "," & someValue3 & ")"
' Debug.Print mySQLcommand
CurrentDb.Execute mySQLcommand, dbFailOnError
where tableName is the table to which we append the data
FieldSomeName, FieldSomeValue1, FiedlSomeValue2, FiedSomeValue3 is
the list of fields we put data into
SomeName a variable with a name for put in FieldSomeName
someValue1 a variable with a numerical value to put in
FieldSomeValue1
You can remove the ' in
' Debug.Print mySQLcommand
to print the sql command in the immediate debug window so that you can see
what is wrong if anything goes wrong with it. In fact, you can then paste it
into the SQL view of a query in the query designer to 'run it'.
Vanderghast, Access MVP
"Ozgur" <(E-Mail Removed)> wrote in message
news:47CF25E9-BF90-4E98-957F-(E-Mail Removed)...
> Hello Michel,
>
> Thank you for your quick reply. I will use them also.
>
> I am using an interface software to get data from a host.
> In excel I can define it and define variables coordinates on this
> interface
> and copy them in excel cells.
>
> Is it possible to convert module below to access language?
>
> Maybe my module that I use in excel can help me explain:
>
> Dim swap, System, Sessions, Session, Screen As Object
> Dim check As Boolean
> Dim typ2, sase, land, RowX, RXE As String
> Dim warten As Integer
>
> Sub Data ()
>
> Set swap = Worksheets("Vehicles")
> Set System = CreateObject("EXTRA.System")
>
> Set Sessions = System.Sessions
>
> Set Session = Sessions.Open("C:\Documents and
> Settings\a8990\Desktop\manhost.edp")
> Set Screen = Session.Screen
>
> If (System Is Nothing) Then
> msg$ = "EXTRA! System Object can not be created!"
> MsgBox msg$, 48, "Fehler"
> Stop
> End If
>
> If (Sessions Is Nothing) Then
> msg$ = "EXTRA! Sessions Object can not be created!"
> MsgBox msg$, 48, "Fehler"
> Stop
> End If
>
> If (Screen Is Nothing) Then
> msg$ = "EXTRA! Screen Object can not be created!"
> MsgBox msg$, 48, "Fehler"
> Stop
> End If
>
> RowX = InputBox("Please enter first row to start:" & Chr$(10))
> RXE = InputBox("Please enter last row to end:" & Chr$(10))
>
> check = False
>
> Do
> Do While RowX <= RXE
>
> typ2 = swap.Cells(RowX, 3)
> typ2 = UCase(Trim(typ2))
>
> sase = swap.Cells(RowX, 4)
> sase = UCase(Trim(sase))
>
> Screen.SendKeys ("<pf4>")
> Call Warteroutine
>
> Screen.putstring "AA76A", 2, 2
> Screen.putstring Space$(1), 2, 8
> Screen.putstring Space$(4), 2, 11
> Screen.putstring Space$(5), 2, 16
> Screen.putstring Space$(3), 2, 23
> Screen.putstring Space$(4), 2, 27
> Screen.putstring Space$(5), 2, 33
> Screen.putstring Space$(3), 2, 40
> Screen.putstring Space$(6), 2, 45
> Screen.putstring Space$(8), 2, 53
> Screen.putstring Space$(17), 2, 62
>
> Screen.SendKeys ("<enter>")
> Call Warteroutine
>
> Screen.putstring typ2, 2, 23
> Screen.putstring sase, 2, 27
>
> Screen.SendKeys ("<enter>")
> Call Warteroutine
>
> '******COUNTRY*************************************
> If CheckBox3 = True Then
> Call Countryinfo
> End If
>
> RowX = RowX + 1
> If RowX = RXE + 1 Then
> check = True
> Exit Do
> End If
> Loop
> Loop Until check = True
>
> ActiveWorkbook.Save
>
> End Sub
>
> Public Sub Warteroutine()
> warten = 0
> While Screen.oia.XStatus = 5
> Screen.waithostquiet (1)
> warten = warten + 1
> If warten > 500 Then
> MsgBox ("!!!Sistem durdu!!!")
> Exit Sub
> End If
> Wend
> End Sub
>
> Public Sub Countryinfo()
>
> land = Screen.Getstring(7, 67, 14)
> land = Format(land, "@")
> swap.Cells(RowX, 8).NumberFormat = "@"
> If Left(land, 5) = " " Then
> swap.Cells(RowX, 8).Value = Null
> Else: swap.Cells(RowX, 8).Value = land
> End If
>
> End Sub