Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rename database in combination textbox

Status
Not open for further replies.

breukelen

Technical User
Oct 31, 2001
54
0
0
NL
I want to use the text in textbox to rename database.

name c:\test.mdb as c:\"text1.text".mdb.

This gives syntax error so instead of "text1.text "
it must be different.
Help is appreciated.

Gunter
 
Try this faq705-2714

This should help you with your task.

David Pimental
(US, Oh)
dpimental@checkfree.com
 
Use concatenation to build the new name:
Code:
Name "c:\test.mdb" as "c:\" & text1.text & ".mdb"
You'll probably want to use a function to check the text in the text box first, something like:
Code:
Private Sub cmdChange_Click()
  If GetNewName(Text1.Text) <> "" Then
    Name strOldDatabase As GetNewName(Text1.Text)
  Else
    Msgbox "Please enter a new name"
  End If
End Sub

Public Function GetNewName(ByVal strName As String) As String
  If Len(strName) > 0 Then
    ' add other logic here to check for valid path,
    ' valid extension, etc.
    GetNewName = "C:\" & strName & ".mdb"
  Else
    GetNewName = ""
  End If
End Function


VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Thanks very much for your help.
VBSlammer I light a candle for you so your unemployment
situation will be ending soon.

Once more thanks !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top