B
Ben
I am trying to use vb code to change the source database
and destination database of an ammend query.
I am using the following code:
Private Sub cmdaddrec_Click()
Dim qry As QueryDef
Dim prp As Property
Dim qry2 As QueryDef
Dim prp2 As Property
For Each qry In CurrentDb.QueryDefs
For Each prp In qry.Properties
If prp.name = "Source Database" Then
prp.Value = Text0.Text
End If
Next prp
Next qry
For Each qry2 In CurrentDb.QueryDefs
For Each prp2 In qry2.Properties
If prp2.Value = "Destination DB" Then
prp2.Value = Text5.Text
End If
Next prp2
Next qry2
Exit Sub
Err_cmdaddrec_Click:
MsgBox "One or more databases could not be found!"
End Sub
The problem is that the source and destination database
property name isn't in the qry.properties list. Can anyone
help?
and destination database of an ammend query.
I am using the following code:
Private Sub cmdaddrec_Click()
Dim qry As QueryDef
Dim prp As Property
Dim qry2 As QueryDef
Dim prp2 As Property
For Each qry In CurrentDb.QueryDefs
For Each prp In qry.Properties
If prp.name = "Source Database" Then
prp.Value = Text0.Text
End If
Next prp
Next qry
For Each qry2 In CurrentDb.QueryDefs
For Each prp2 In qry2.Properties
If prp2.Value = "Destination DB" Then
prp2.Value = Text5.Text
End If
Next prp2
Next qry2
Exit Sub
Err_cmdaddrec_Click:
MsgBox "One or more databases could not be found!"
End Sub
The problem is that the source and destination database
property name isn't in the qry.properties list. Can anyone
help?