473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

AddNew - Pocket PC

I am running this on a Pocket PC NOT on a PC.
I am trying to add a row from Table A into table B.
This must be possible!!!!!

Any assistance appreciated.

Cheers
Clive

+++++++++++++++++++++++++++++++++++++++
Private Sub Test_Click()
Dim RS2 As ADOCE.Recordset
Dim SQL As String
Dim InputText As String
Dim ColumnNames As String
Dim ColumnValues As String
Dim ParamName As String
Dim MyVar As String
Set RS2 = CreateObject("ADOCE.Recordset.3.1")

RS2.Open Test, "\My Documents\Housing.cdb"

' UPDATE test INNER JOIN HousingEstates ON (test.BlockName = HousingEstates.Block)
' AND (test.ContractArea = HousingEstates.ContractArea) SET;

'SQL = "SELECT * FROM ContractAreas INNER JOIN HousingEstates"
'SQL = SQL & " ON ContractAreas.ContractArea = HousingEstates.ContractArea"
'SQL = SQL & " WHERE ContractAreas.ContractArea = 2"
'RS("Blockname") = Block

MyVar = "Scott Court"
MsgBox (MyVar)

SQL = "SELECT * FROM HousingEstates "
SQL = SQL & " WHERE HousingEstates.Block = '" & MyVar & "'" 'Scott House'"
Block = SQL
RS2.AddNew
RS("BlockName") = Block

Dim ifield As Integer
For ifield = 0 To RS.Fields.Count - 1
RS2.Fields(ifield).Value = RS.Fields(ifield).Value
Next

RS2.Update

'Remove existing data from grid
For i = 1 To GridCtrl1.Rows
GridCtrl1.RemoveItem 0
Next

'Set the Grid columns equal to the field count
GridCtrl1.Cols = RS.Fields.Count

'Get the column names
For i = 0 To RS2.Fields.Count - 1
ColumnNames = ColumnNames & RS2.Fields(i).Name & vbTab
Next

'Add the column headers to the grid
GridCtrl1.AddItem ColumnNames

'Loop through the recordset
While Not RS.EOF

'Get the column values for this row
For i = 0 To RS2.Fields.Count - 1
ColumnValues = ColumnValues & RS2.Fields(i).Value & vbTab
Next

'Add the column values to the row
GridCtrl1.AddItem ColumnValues

'Set ColumnValues to a zero length string
'so it can be refilled with the next row
ColumnValues = ""

RS.MoveNext
Wend

'Close and dereference the Recordset
RS2.Close
Set RS2 = Nothing

End Sub
Nov 12 '05 #1
1 1976
Pocket Access isn't the same thing as Access, so I have no way of checking,
but is there an INSERT INTO statement available to you?

The usual syntax is

Multiple-record append query:

INSERT INTO target [IN externaldatabase] [(field1[, field2[, ...]])]
SELECT [source.]field1[, field2[, ...]
FROM tableexpression

Single-record append query:

INSERT INTO target [(field1[, field2[, ...]])]
VALUES (value1[, value2[, ...])

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

<cl************@yahoo.co.uk> wrote in message
news:41*************************@posting.google.co m...
I am running this on a Pocket PC NOT on a PC.
I am trying to add a row from Table A into table B.
This must be possible!!!!!

Any assistance appreciated.

Cheers
Clive

+++++++++++++++++++++++++++++++++++++++
Private Sub Test_Click()
Dim RS2 As ADOCE.Recordset
Dim SQL As String
Dim InputText As String
Dim ColumnNames As String
Dim ColumnValues As String
Dim ParamName As String
Dim MyVar As String
Set RS2 = CreateObject("ADOCE.Recordset.3.1")

RS2.Open Test, "\My Documents\Housing.cdb"

' UPDATE test INNER JOIN HousingEstates ON (test.BlockName = HousingEstates.Block) ' AND (test.ContractArea = HousingEstates.ContractArea) SET;

'SQL = "SELECT * FROM ContractAreas INNER JOIN HousingEstates"
'SQL = SQL & " ON ContractAreas.ContractArea = HousingEstates.ContractArea" 'SQL = SQL & " WHERE ContractAreas.ContractArea = 2"
'RS("Blockname") = Block

MyVar = "Scott Court"
MsgBox (MyVar)

SQL = "SELECT * FROM HousingEstates "
SQL = SQL & " WHERE HousingEstates.Block = '" & MyVar & "'" 'Scott House'"
Block = SQL
RS2.AddNew
RS("BlockName") = Block

Dim ifield As Integer
For ifield = 0 To RS.Fields.Count - 1
RS2.Fields(ifield).Value = RS.Fields(ifield).Value
Next

RS2.Update

'Remove existing data from grid
For i = 1 To GridCtrl1.Rows
GridCtrl1.RemoveItem 0
Next

'Set the Grid columns equal to the field count
GridCtrl1.Cols = RS.Fields.Count

'Get the column names
For i = 0 To RS2.Fields.Count - 1
ColumnNames = ColumnNames & RS2.Fields(i).Name & vbTab
Next

'Add the column headers to the grid
GridCtrl1.AddItem ColumnNames

'Loop through the recordset
While Not RS.EOF

'Get the column values for this row
For i = 0 To RS2.Fields.Count - 1
ColumnValues = ColumnValues & RS2.Fields(i).Value & vbTab
Next

'Add the column values to the row
GridCtrl1.AddItem ColumnValues

'Set ColumnValues to a zero length string
'so it can be refilled with the next row
ColumnValues = ""

RS.MoveNext
Wend

'Close and dereference the Recordset
RS2.Close
Set RS2 = Nothing

End Sub

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: santhosh_176 | last post by:
:I Created a Pocket PC application for iPAQ 5450. Every thing went fine even installer creation. I could run the setup and install it into the actual device and worked fine. The application enables...
0
by: clivegisworkuk | last post by:
I am running this on a Pocket PC NOT on a PC. I want to select a row of data, then insert the row of data from tableA into tableB. Is this possible??? Any assistance would be appreciated as I...
5
by: Oliver Huppert | last post by:
Hi all, can someone tell me what I need to develop applications for PPC2003 with C#? I have read several meanings about this topic. Do I need Visual Studio .NET or is Visual C# .NET Standard...
8
by: Krishnan Margabandhu | last post by:
I'm writing a Pocket PC app that will run when a device is first powered on. I want this program to get some data from the user and invoke a CAB file to install a software on the device. How do I...
10
by: Neil Wallace | last post by:
Guys, I am hopping mad. I am just a hobby programmer making little .net applications for pretty much no-one else but me to use. One application I have written would, to my mind, work best on...
2
by: Kent Briggs | last post by:
I'm a Delphi programmer with a need to create a Pocket PC app. Since full support for the .NET Compact Framework won't be added to Delphi for another year, I'm looking at learning VB. Apparently I...
3
by: Daniel Liberman | last post by:
Hi, everyone. That's my environment: - I have a pocket pc (iPAQ h4350) application developed with VSNET2003/C# that has a SQL Server CE Database, running. That's working fine. Obs: the pocket...
0
by: pumaken68 | last post by:
Does anyone has experience with calling web service from pocket pc 2003 project in VS 2005 environment? I just migrated a smart device(pocket pc 2003) solution from VS 2003 to VS 2005. There are...
5
by: Terry Metcalfe | last post by:
I have an Asus A696 pocket PC. I have written a small test program in VB6 called "Pocket PC" and compiled it just as I would normally do to run on my desk top. It runs on my desk top perfectly...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.