J
JJ
Not sure if I should post this under word vba worc or access because
it involves both.
I have an access database where I have different fields having
relationships with other databases e.g. I have a field which is called
Branch then I have a relationship with a Branch table where in the
original database when you get to the Branch field you click on the
combobox in access and select a different branch (so its like a drop
down in the access database allowing you to select either CT, JHB or
DBN.
From word 2003 I am reading info from that database as follows:
strADNDB = "c:\apps\adndatabase.mdb"
strMASTPATH = ""
Set ADNDataBase = OpenDatabase(strADNDB) intRecords = "0"
Set rdAuthor = ADNDataBase.OpenRecordset("Author")
For intRecords = 0 To rdAuthor.RecordCount - 1
If rdAuthor.Fields(1).Value = Application.UserName Then
If rdAuthor.Fields(10).Value = "1" Then
OptionButton1.Value = True
End If
If rdAuthor.Fields(10).Value = "2" Then
OptionButton2.Value = True
End If
If rdAuthor.Fields(10).Value = "3" Then
OptionButton3.Value = True
End If
rdAuthor.MoveNext
Else
rdAuthor.MoveNext
End If
Next intRecords
rdAuthor.Close
ADNDataBase.Close
This works well but I battled to determine that the field value "1" is
actually JHB and field value "2" is CT and field value "3" is DBN.
I would want to have a different instruction where I can actually read
the text which is JHB or CT or DBN.
So it should say:
If rdAuthor.Fields(10).Value = "JHB" Then
OptionButton2.Value = True
End If
etc.
However, because the drop down is read from another table it uses a
number to see if you selected the first one in the list or the second
or the third.
For this option it is ok but my next step is where I have 200
departments and I will take hours to try and figure out which
department is actually which number.
Any ideas where I can maybe say If rdAuthor.Fields(10).Text or
TextValue or whatever is "JHB" Then .......
Hope you understand what I mean. Any help will be greatly appreciated.
Is there a way I can upload my database then you can see what I mean
if you don't understand.
it involves both.
I have an access database where I have different fields having
relationships with other databases e.g. I have a field which is called
Branch then I have a relationship with a Branch table where in the
original database when you get to the Branch field you click on the
combobox in access and select a different branch (so its like a drop
down in the access database allowing you to select either CT, JHB or
DBN.
From word 2003 I am reading info from that database as follows:
strADNDB = "c:\apps\adndatabase.mdb"
strMASTPATH = ""
Set ADNDataBase = OpenDatabase(strADNDB) intRecords = "0"
Set rdAuthor = ADNDataBase.OpenRecordset("Author")
For intRecords = 0 To rdAuthor.RecordCount - 1
If rdAuthor.Fields(1).Value = Application.UserName Then
If rdAuthor.Fields(10).Value = "1" Then
OptionButton1.Value = True
End If
If rdAuthor.Fields(10).Value = "2" Then
OptionButton2.Value = True
End If
If rdAuthor.Fields(10).Value = "3" Then
OptionButton3.Value = True
End If
rdAuthor.MoveNext
Else
rdAuthor.MoveNext
End If
Next intRecords
rdAuthor.Close
ADNDataBase.Close
This works well but I battled to determine that the field value "1" is
actually JHB and field value "2" is CT and field value "3" is DBN.
I would want to have a different instruction where I can actually read
the text which is JHB or CT or DBN.
So it should say:
If rdAuthor.Fields(10).Value = "JHB" Then
OptionButton2.Value = True
End If
etc.
However, because the drop down is read from another table it uses a
number to see if you selected the first one in the list or the second
or the third.
For this option it is ok but my next step is where I have 200
departments and I will take hours to try and figure out which
department is actually which number.
Any ideas where I can maybe say If rdAuthor.Fields(10).Text or
TextValue or whatever is "JHB" Then .......
Hope you understand what I mean. Any help will be greatly appreciated.
Is there a way I can upload my database then you can see what I mean
if you don't understand.