Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 17th, 2003, 08:07 AM
anca anca is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 30 anca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Question Transfer records from a MDB to another

I am only a beginner with VB even if I am an expert in VFP. I want to do something that requires only some lines in VFP but seems to be very complicated in VB:

1. I have two MDB files. And I want to transfer all records from a table of the first MDB to a table from the second MDB. We can suppose it's tha same structure. The destination table is not empty but I don't need old records anymore.

2. Is it possible to use in a SQL command 2 tables from 2 different MDB files?

3. Is it possible to use a FIND method to search a value stored in a variable ? In VFP I can do something like:
X = "Mary's book"
LOCATE for name=X
I have problems in VB because there is a ' in the value to search for. I may have a " also, or maybe both. What should I do?
__________________
Anca

Reply With Quote
  #2  
Old December 17th, 2003, 10:53 AM
williamcrawley williamcrawley is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: uk
Posts: 91 williamcrawley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
In your search where you need a ' or a " use '' and "" (i.e. double up on the quote)

Reply With Quote
  #3  
Old December 17th, 2003, 07:11 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
Here is a simple way to do it. I am assuming that you just want to copy the file. To

Private Sub mnuCopy_Click()
Dim txtdbpath As String 'this is your database file
Dim txtdbpathcopy As String 'this is your copy path

'the following double checks, Are you sure?

intResponse = MsgBox("Are you sure that you wish to make a copy of your database file now?", vbYesNo + vbDefaultButton1 + vbQuestion, "Cannot find Database")

If (intResponse = 6) Then
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile txtdbpath, txtdbpathcopy, True
Else
' Code goes here that handles the NO click
End If

End Sub

Reply With Quote
  #4  
Old December 18th, 2003, 03:57 AM
anca anca is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 30 anca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
I would like to be that simple....

Thank you for answers, but....

I already found the idea to double the ' and the ". But the problem is that I don't really know what the user want to search for. He write a text and I have to search for. The text is inside a text box and may include ' or ". There is no other way that to search for ' and replace with double ' before the search command?
In many languages I can search for a value stored in a variable. There is nothing like this in VB ?????

And for the other problem - with the copy of the database...
Is not what I want to do. I just want to copy a table from a database inside another database. And not just copy - I want to transfer records and maybe make some changes at the same time (like double the values in a column). I need something flexible that will let me "play" with values if I need.

Maybe... Can I use a SELECT to "copy" data from a MDB and save with "INTO" in another MDB ? I can do this in other languages...

Reply With Quote
  #5  
Old December 18th, 2003, 07:42 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
U can ask Fisherman who in this forum!He is good at DB & VB program!Send Message to him!A fast help will return to u!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Transfer records from a MDB to another


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT