Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / September 2005

Tip: Looking for answers? Try searching our database.

Temp table in DAO

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tracy - 01 Sep 2005 15:55 GMT
I have a switchboard that opens my Home form that when clicked upon in two
errors has code to open my f_PrimaryEntryScreen which has two subforms -
f_BudgetUnit and f_PrimaryEntry.  When I click on a record in f_BudgetUnit it
opens up in f_PrimaryEntry the appropriate records.  f_PrimaryEntry's record
source is a table because I can't use a crosstab query to update on my form.  
With that said, (perhaps more info than necessary), because I will have
multiple users, possibly at the same time, I need my table to be a temp table
and to automatically update my other tables.  I believe I need to do I Make
table in DAO.  Can you give me some direction?  I'm not even sure where I
begin to write the code in the f_PrimaryEntry form.  Thanks a ton!
Klatuu - 01 Sep 2005 17:39 GMT
Have you tried using a select query as your record source for f_PrimaryEntry?

> I have a switchboard that opens my Home form that when clicked upon in two
> errors has code to open my f_PrimaryEntryScreen which has two subforms -
[quoted text clipped - 6 lines]
> table in DAO.  Can you give me some direction?  I'm not even sure where I
> begin to write the code in the f_PrimaryEntry form.  Thanks a ton!
Tracy - 01 Sep 2005 19:31 GMT
Yes, but because it's fed from the crosstab, it won't let me edit the form so
I made a make table.  The only thing is, the make table needs to be a temp
table because I could have multiple users at the same time.  So, I created a
database with the f_Temp file.  I don't understand though how I get that
temporary file back into my current database but I'm thinking that if I do a
Temp table in DAO then that will solve my problem.  From what I understand,
it can be created to update all the other relating tables but I can't figure
out how to put it all together.  There are only two fields on the
f_PrimaryEntry form that are updatable - UCh_sort_num and UCh_amount.  I am
so desperate to get this completed and I really appreciate your expertise.

Tracy

> Have you tried using a select query as your record source for f_PrimaryEntry?
>
[quoted text clipped - 8 lines]
> > table in DAO.  Can you give me some direction?  I'm not even sure where I
> > begin to write the code in the f_PrimaryEntry form.  Thanks a ton!
Klatuu - 01 Sep 2005 19:42 GMT
So, the crosstab query is the record source for the form, but you need to
update a table based on changes made in the form?  If so, this will take a
little work. Let me know if my understanding is correct, and give me an idea
of your experience level with VBA, and I can give you a solution or two

> Yes, but because it's fed from the crosstab, it won't let me edit the form so
> I made a make table.  The only thing is, the make table needs to be a temp
[quoted text clipped - 21 lines]
> > > table in DAO.  Can you give me some direction?  I'm not even sure where I
> > > begin to write the code in the f_PrimaryEntry form.  Thanks a ton!
Tracy - 01 Sep 2005 20:04 GMT
I created a select query using a crosstab and another necessary query but it
still recognized it as a crosstab and wouldn't let me update my form so I
created a make table from that select query and named it f_PrimaryEntry.  
However, this won't work for multiple users and updating the tables
dynamically.  So, from what I read, I need a temp table in DAO but my
experience in VB is very limited and I seem to be going in circles with what
I'm attempting.  Thanks!!!

> So, the crosstab query is the record source for the form, but you need to
> update a table based on changes made in the form?  If so, this will take a
[quoted text clipped - 26 lines]
> > > > table in DAO.  Can you give me some direction?  I'm not even sure where I
> > > > begin to write the code in the f_PrimaryEntry form.  Thanks a ton!
Klatuu - 01 Sep 2005 20:51 GMT
hmmm...
The multiple users issue is a little trickier, because with only one table,
every user would be adding to the same table and that would create problems.  
The other problem is that neither a query or a table of any kind will update
your tables if they are not bound to the form, so this is sort of like using
an unbound form.  That is why I asked about your VBA experience.  This is the
only way you are going to be able to do what you want.
I don't have time to write all the code for you, but here are a few pointers.
First you will have to open the tables you need to update as dbOpenDynasets

Dim rstTableOne as Recordset
Dim rstTableTwo as Recordset
Set rstTableOne = CurrentDb.OpenRecordset("FirstTableName", dbOpenDynaset)
Set rstTableTwo = CurrentDb.OpenRecordset("SecondTableName", dbOpenDynaset)

Now, once you have all the data in, you will need a command button to
actually do the updates.  You would put the code to do the updates in the
Click event of the command button.  This code doesn't do any error handling
or validation.  You will have to add that.
First, you need to determine whether it is a new record:

strFind = "[FIELD_NAME_TO_MATCH_1] = '" Me.txtFirstField & "' AND
[FIELD_NAME_TO_MATCH_2] = '" & Me.txtSecondField & "'"

With rstTableOne
   .FindFirst strFind
   If .NoMatch Then
       .AddNew
   Else
       .Edit
   End If
       !FieldOne = Me.txtSomeField
       !FieldTwo = Me.txtAnotherField
   .Update
End With

And do the other table the same way.

Good luck!  This is a great learning experience for you

> I created a select query using a crosstab and another necessary query but it
> still recognized it as a crosstab and wouldn't let me update my form so I
[quoted text clipped - 34 lines]
> > > > > table in DAO.  Can you give me some direction?  I'm not even sure where I
> > > > > begin to write the code in the f_PrimaryEntry form.  Thanks a ton!
Tracy - 01 Sep 2005 22:07 GMT
Klatuu, Thanks for the information.  So, what you're saying is that the form
will be unbound so I'll be using no record source but entering the code.  
Where do I put the code on the f_PrimaryEntry form that you began with shown
below?  Or is that wrong and I do use a make table query and bind it to my
form but I put in the code and command button as well?

Dim rstTableOne as Recordset
Dim rstTableTwo as Recordset
Set rstTableOne = CurrentDb.OpenRecordset("FirstTableName", dbOpenDynaset)
Set rstTableTwo = CurrentDb.OpenRecordset("SecondTableName", dbOpenDynaset)

Sorry to be a pain...  I appreciate your help.

Tracy

> hmmm...
> The multiple users issue is a little trickier, because with only one table,
[quoted text clipped - 74 lines]
> > > > > > table in DAO.  Can you give me some direction?  I'm not even sure where I
> > > > > > begin to write the code in the f_PrimaryEntry form.  Thanks a ton!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.