Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 26th, 2007, 02:23 PM
Authorized User
 
Join Date: Apr 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok I am very very close now. I figured out that the code needed to be seperated out. So now this is what happens:

Click on a date on the control while in a current record the date gets updated (Not Good: it should either create a new record or go to a record with that date)

When I move to an empty record and click a new date that does not exist it saves the date in the current empty record and moves to a new record. (This is bad because it forces the user to have to navigate back to the previous record)

When I move to an empty record and click on a date that does exist, it always goes to the first record (not good)

Another thing is that I am using the EntryID form the calendar table which is an auto number to navigate to the appropriate record ID. This is bad because what happens when a date is deleted from the calendar table? That would mean the entryIDs are no longer a valid reference to the record ID I want to go to. Please help if you can. Here is the code:

Option Compare Database
Private Sub CalendarCtl_Click()

Dim calendarqry As New Class1

If Me.Dirty = True Then
    Me.Dirty = False
End If

Recordqry

End Sub

Private Sub Recordqry()
Dim strSQL As Variant
Dim vart As Variant

strSQL = DLookup("[Datefld]", "Calendartbl", [RepID] = Forms![Scheduling]![RepID_bx] And [Datefld] = [Forms]![Scheduling]![Calendar_subform].[Form]![Date_bx])

If Me!Date_bx <> strSQL Then
DoCmd.GoToRecord , , acNewRec

Else
vart = DLookup("[EntryID]", "Calendartbl", [RepID] = Forms![Scheduling]![RepID_bx] And [Datefld] = [Forms]![Scheduling]![Calendar_subform].[Form]![Date_bx])
If Not IsNull(vart) Then
   Entry_ID = vart
End If
DoCmd.GoToRecord , , acGoTo, vart
End If
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Use LinkButton to pull record from DataList rdove84 ASP.NET 3.5 Basics 0 June 4th, 2008 08:53 AM
double click for specific record naveed77 Beginning VB 6 0 December 4th, 2007 04:55 AM
Combo to Search for Record w/Calendar Object Odeh Naber Access 10 May 14th, 2007 07:23 AM
How to create event in Calendar smartacrobat ASP.NET 2.0 Basics 0 January 4th, 2007 02:54 AM
Getting date from Calendar 9 into a new record johnkeeb Access VBA 4 November 8th, 2004 11:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.