|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
In your search where you need a ' or a " use '' and "" (i.e. double up on the quote)
|
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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... |
|
#5
|
|||
|
|||
|
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!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Transfer records from a MDB to another |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|