Combo Box Data Row Source

K

kenrav

I recently upsized my BE to SQL Server 2008 Express. As expected, my new
tables all have a "dbo_" prefix. I can easily do a 'Search & Replace' in my
code to accommodate the new names. However, I have a great many combo boxes
which reference the original table names in the Data Row Source property that
need to be changed. Does anyone know how to do this universally or do I need
to change each one individually? Thanks.
 
D

Douglas J. Steele

Why not just rename your linked tables?

Dim db As DAO.Database
Dim tdf As DAO.TableDef

Set db = CurrentDb()
For Each tdf In db.TableDefs
If Left$(tdf.Name, 4) = "dbo_" Then
tdf.Name = Mid$(tdf.Name, 5)
End If
Next tdf

Set tdf = Nothing
Set db = Nothing
 
K

kenrav

Works great! Thanks!

Ken

Douglas J. Steele said:
Why not just rename your linked tables?

Dim db As DAO.Database
Dim tdf As DAO.TableDef

Set db = CurrentDb()
For Each tdf In db.TableDefs
If Left$(tdf.Name, 4) = "dbo_" Then
tdf.Name = Mid$(tdf.Name, 5)
End If
Next tdf

Set tdf = Nothing
Set db = Nothing

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top