Form with name field

  • Thread starter Thread starter Steve Schapel
  • Start date Start date
S

Steve Schapel

Blair,

Do you mean you have 2 separate applications, i.e. a separate copy of
the frontend and backend files for the two farms? Or do you mean you
have a single frontend application file, but 2 backend data files, and
the frontend links to the aplicable backend data file depending on the
farm selection on your switchboard? If the second scenario, how are you
selecting the farm?... Sounds like it might be via using a bound control
with the farm name, am I right?
 
I have a 97 db to keep ranch records of animals.The opening form has has the
farm name showing. I now have two separate farms and want to use the same db
for both farms, so I saved the database in another folder with another name
with separate be files and have them linked properly.
My proplem is I have another form I use to change the farm name in my
opening form. lets say the farm name is now AJ Farm. I go to the other db on
the same machine and change the second db farm name to SBG Farm and it will
change them both to SBG farm. I have tried changing to diferent harddrives,
dif names to the db files, it makes no differince can anyone explain what
might be wrong?

Thanks Blair
 
This is the code behind the form, I thought this might help out
Thanks Blair

Private Sub Form_Load()

Open "Remate Date" For Random As #2 Len = 50
Get #2, 2, RemateDate
Close #2
Text12 = RemateDate

Open "Farm Name" For Random As #1 Len = 50
Get #1, 1, FarmName
Close #1
Text1 = FarmName

End Sub


Private Sub Text1_AfterUpdate()
FarmName = Text1
Open "Farm Name" For Random As #1 Len = 50


Put #1, 1, FarmName

Close #1 ' Close file.

End Sub
 
Do you mean you have 2 separate applications, i.e. a separate copy of
the frontend and backend files for the two farms?

Yes this is the case, I just made a copy of the application and saved it in
another folder, then made two separate short cuts to open either or which
one I want to input data at the time
The be files are linked seperatly and work just that the farm name is
some how connected to the two front end applications
I sent the form code in another post

Thanks Blair
 
Or do you mean you
have a single frontend application file, but 2 backend data files, and
the frontend links to the aplicable backend data file depending on the
farm selection on your switchboard?

I like the sound of this option. But how would you do this? I haven't worked
with the db for a few years and I'm not up to speed yet Plus I was never to
fast to begin with, to get back up to speed.

Thanks Blair
 
Blair,

I'm afraid I am not familiar enough with this sort of code to be able to
figure out what it is supposed to do. Hopefully someone else can chime in.
 
Blair,

You could have a control, let's say a Combobox or an Option Group, on
the switchboard, where you select which farm you want to work with. On
the After Update event of this control, your code would be something
along these lines (caution: untested air code!)...

Dim dbs As Database
Dim tdf As DAO.TableDef
Dim BackendFile As String
Set dbs = CurrentDb
Select Case Me.YourOptionGroup
Case 1 'AJ
BackendFile = "C:\YourFolder\AJ_be.mdb"
Case 2 'SBG
BackendFile = "C:\YourFolder\SBG_be.mdb"
End Select
For Each tdf In dbs.TableDefs
If Len(tdf.Connect) > 0 Then
tdf.Connect = ";DATABASE=" & BackendFile
tdf.RefreshLink
End If
Next tdf
Set dbs = Nothing
 
Blair said:
What are you calling a switchboard? Is it a form used for this purpose, or
is it somthing else in A97 that I am not using?

Blair, I think I am referring to the same thing as what you mean by
"opening form". Sorry for the confusion - I had in my mind that this
was the term you had used, but I now see that you didn't.
 
Hi steve
What are you calling a switchboard? Is it a form used for this purpose, or
is it somthing else in A97 that I am not using?
About the other code
I wonder it is creating a file of some sort to store and retreve the farm
name, and both programs are accessing the same file. My problem is I don't
know where to look for this file.
However I am going to look into doing it your way if I can figure it out.
Thanks Blair
 
Back
Top