Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting

Post new topic   Reply to topic
Need serious help in linking of points in VB to MS access
View previous topic :: View next topic  
Author Message
er_feng
Newbie


Joined: 27 Jul 2005
Posts: 12

PostPosted: Sep 15th, 2005 04:35 AM    Post subject: Need serious help in linking of points in VB to MS access Reply with quote

My problem now is to store the X-Y coordinates values to the MS access directly. Because i'm doing plotting of drag-and-drop points on a map then the values will be store in a notepad now, then i need to do out a contour, but i want to store it directly to an access database. If not i would have to open the notepad and see the values then i need to type those values to access database before i could excute a contour (drawing out a circle around the points that i put the points).
Back to top
View user's profile Send private message
dougthomas
Moderator


Joined: 27 Jul 2005
Posts: 271
Location: Essex, UK

PostPosted: Sep 17th, 2005 04:46 AM    Post subject: Reply with quote

Hi, sorry for the delay,

I've spent about 10 days on and off trying to get to grips with this "code". The major problem is that there is a mixture of flat files and database tables. The information you are actually wanting is in the file(s) suffixed by ".2" (Called Database, of filetype "File".)

However, it looks as if Table "40" of the mdb can be populated with the access points. In the main form, in routine picfloorplan_DragDrop you need to modify the code with:
Code:

If ObjectCombo.ItemData(ObjectCombo.ListIndex) = 3 Then ' Draw Mark Point Start
   
    lblpt.Move 720, 240
   
    picFloorplan.DrawWidth = 7
    picFloorplan.PSet (X, Y), vbRed
    intCount = intCount + 1
    Frame1.Visible = True
    strSQL = "INSERT INTO 40 (Number, X , Y) VALUES("
    strSQL = strSQL & intCount & "," & X & "," & Y & ")"
    Set db = OpenDatabase(SelectDatabase.Database_Location.Text)
    db.Execute strSQL
    Set db = Nothing
End If ' Draw Mark Point Stop

Just before the end of the subroutine.

You will need to declare "Public intCount As Integer" in the Contour_Module Module and set it to Zero in the Main_Form Load Event.

In Routine DrawContour40, after the Dims etc you will need to modify what's there with:
Code:

Set db = OpenDatabase(SelectDatabase.Database_Location.Text)
With db

    Set rstInfo = .OpenRecordset("40")
    With rstInfo
       
        .MoveFirst 'Move to first record
       

For t = 0 To 3
    p(t).X = !X
    p(t).Y = !Y
    .MoveNext
    If .EOF Then Exit For
Next t

With good luck and a following wind you should end up with the access points in the Database in Table 40 and the array p() populated with them prior to calling the Biezer processing.

This is a real "cludge" in MHO the whole thing needs re-writing with some meaningful comments and re-structured.

A word about comments:
With rst
.MoveFirst ' move to the first record
is not really helpful!

The reason the Biezer Function is not working properly is because you are assigning values 1 to 4 in the p() object and then using values 0 to 3 in the Biezer. You'll note that I have changed that in the code above (for t = 0 to 3 rather than t = 1 to 4)


Hope this helps
Regards
Doug
_________________
If you can see the light at the end of the tunnel, it probably means there's a Train coming.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic