Solved

snapshots

Posted on 1998-08-26
5
332 Views
Last Modified: 2010-04-30
Can I relate a snapshot from a table to a dynaset in another table?

thanks
Alberto
0
Comment
Question by:asimoes
5 Comments
 
LVL 4

Expert Comment

by:mcix
ID: 1431109
I don'y understand your questionm can you provide more details?
0
 

Author Comment

by:asimoes
ID: 1431110
As I see it,  a snapshot is some information retrieved from a table that cannot be updatable and a dynaset can be updatable.
Well, in the relation of this two tables can i retrieve information of the first one (by a snapshot) for some fields (that I don't want to update) and relate them to the  second information of a second table that I must update ?
Another question: How can I format a text box for currency?
0
 
LVL 1

Expert Comment

by:rlarner
ID: 1431111
I don't understand what you mean by 'relate'.  Are you planning on opening up a 3rd recordset equal to a join of the two tables?  Are you going to loop through one table, finding related values in another table?  More information would be helpful.

Also -- you probably want to post the text box question seperately.
0
 
LVL 1

Accepted Solution

by:
JayMerritt earned 200 total points
ID: 1431112
Open the snapshot first, loop through it a record at a time and create new dynasets for each record in the snapshot.

DIM SS as RecordSet
DIM DS as RecordSet
Dim WS as WorkSpace
Dim DB as Database
' Create Microsoft Jet Workspace object.

Set ws = CreateWorkspace("", "admin", "", dbUseJet)
Set db = ws.OpenDatabase("MY.mdb", True)
'Open Snapshot first
sql = "SELECT * FROM tblTableA"
Set SS = DB.OpenRecordSet(sql, dbOpenSnapshot)
Do until SS.EOF
  sql = "SELECT * FROM tblTableB WHERE tblTableB.Key = " & Cstr(SS!tblTableA.Key))
  Set DS = DB.OpenRecordSet(sql, dbOpenDynaset)
  ' look at your dynaset here
 If DS.EOF Then
    ' nothing found
  Else
    ' something found
    DS.Edit
    DS!FieldA = "new value"
    DS.Update
  Endif
 DS.Close
  Set DS = Nothing
  SS.MoveNext
 ' go to next record in snapshot
Loop

0
 

Expert Comment

by:mskannan
ID: 1431113
Hi asimoes,
Regarding the second question, try this one.

MyStr = Format(5459.4, "$##,##0.00") returns $5,459.00

Also go to keypress event of text box and write code so that it allows only numbers to be keyed in the text box.

Regards,
mskannan


      
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question