i m using access2003 database for my Project. now i have to import data from another access database with the same table name. can any one please tell me how to import data from another access file using codes.please its urgent
Vb Data Import Export
Collapse
X
-
Tags: None
-
Use the Update command, I'd have to look, to make sure. Just make sure the table/tables columns you are updating to in one database are also available and in the same sequence in the other. Also, you may consider posting to the Access forum as well, I am not yet an amateur at this, fancy techniques may be found there :-) -
Originally posted by rajaaryan44i m using access2003 database for my Project. now i have to import data from another access database with the same table name. can any one please tell me how to import data from another access file using codes.please its urgent
1. use import facility of Access itself
2. Make two connections one to retrive date and another to insert this data in other database
for that open one recordset create Qry according to ur actual database and insert using connection object
this is the tech. for actual code u've to try it
I'm able to give it 2 u but i think if u do it by urself then it'll uprise ur confidance
bbye 'n take careComment
-
. i wrote some codes in dao. i created a function : AddTableField
i m writing it in module so that it can be access from anywhere in the program
this is the code
Sub AddTableField(p tdfTableDef As DAO.TableDef, pstrFieldName As String, pintDatatype As Integer, Optional pintSize As Integer, Optional pblnFixedLength As Boolean, Optional pblnAutoIncreme nt As Boolean, Optional pblnAllowZeroLe ngth As Boolean, Optional pblnRequired As Boolean, Optional pstrValidationT ext As String, Optional pstrValidationR ule As String, Optional pvarDefaultValu e As Variant)
Dim fldX As DAO.Field
Dim intSize As Integer
Set fldX = ptdfTableDef.Cr eateField()
fldX.OrdinalPos ition = ptdfTableDef.Fi elds.Count
fldX.Name = pstrFieldName
fldX.Type = pintDatatype
If Not IsMissing(pblnA llowZeroLength) Then
If pintDatatype = dbText And pintSize > 0 Then
fldX.Size = pintSize
Else
fldX.Size = GetFieldSize(pi ntDatatype)
End If
Else
fldX.Size = GetFieldSize(pi ntDatatype)
End If
If fldX.Type = dbLong Then
If pblnAutoIncreme nt = True Then
fldX.Attributes = fldX.Attributes Or dbAutoIncrField
End If
End If
If fldX.Type = dbText Or fldX.Type = dbMemo Then
fldX.AllowZeroL ength = True
End If
If Not IsMissing(pblnR equired) Then
fldX.Required = pblnRequired
End If
If Not IsMissing(pstrV alidationText) Then
fldX.Validation Text = pstrValidationT ext
End If
If Not IsMissing(pstrV alidationRule) Then
fldX.Validation Rule = pstrValidationR ule
End If
If Not IsMissing(pvarD efaultValue) Then
fldX.DefaultVal ue = pvarDefaultValu e
End If
ptdfTableDef.Fi elds.Append fldX
End Sub
.
still i cannot get the transfer doneComment
-
. i wrote some codes in dao. i created a function : AddTableField
i m writing it in module so that it can be access from anywhere in the program
this is the code
Code:. Sub AddTableField(ptdfTableDef As DAO.TableDef, pstrFieldName As String, pintDatatype As Integer, Optional pintSize As Integer, Optional pblnFixedLength As Boolean, Optional pblnAutoIncrement As Boolean, Optional pblnAllowZeroLength As Boolean, Optional pblnRequired As Boolean, Optional pstrValidationText As String, Optional pstrValidationRule As String, Optional pvarDefaultValue As Variant) Dim fldX As DAO.Field Dim intSize As Integer Set fldX = ptdfTableDef.CreateField() fldX.OrdinalPosition = ptdfTableDef.Fields.Count fldX.Name = pstrFieldName fldX.Type = pintDatatype If Not IsMissing(pblnAllowZeroLength) Then If pintDatatype = dbText And pintSize > 0 Then fldX.Size = pintSize Else fldX.Size = GetFieldSize(pintDatatype) End If Else fldX.Size = GetFieldSize(pintDatatype) End If If fldX.Type = dbLong Then If pblnAutoIncrement = True Then fldX.Attributes = fldX.Attributes Or dbAutoIncrField End If End If If fldX.Type = dbText Or fldX.Type = dbMemo Then fldX.AllowZeroLength = True End If If Not IsMissing(pblnRequired) Then fldX.Required = pblnRequired End If If Not IsMissing(pstrValidationText) Then fldX.ValidationText = pstrValidationText End If If Not IsMissing(pstrValidationRule) Then fldX.ValidationRule = pstrValidationRule End If If Not IsMissing(pvarDefaultValue) Then fldX.DefaultValue = pvarDefaultValue End If ptdfTableDef.Fields.Append fldX End Sub
still i cannot get the transfer doneComment
Comment