Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calendar 1

Status
Not open for further replies.

Onslaughtdave

Programmer
Jan 24, 2005
59
CA
Hey!

I am using the calendar to update the date field with the code i read on this forum:
" if me.dirty = true then
me.dirty = false
end if"

however, that worked fine until i set up referencial integrity! now when i try to update the date field using tha calendar, it crashes on "me.dirty = false". Even if all the fields have valid data in them, the integrity fires saying i need a matching record in table "whatever table name" then the next ... until there aren't anymore tables left.

Is there any way around this? or a better way of updating a field in the table with the calendar? or even another textbox or something so i could dump that value into the table.

btw: the date field is on one form and the calendar is on another form that opens up. They are both connected to the same database field via control source.

thanks for the help!!

dave
 
I'm not understanding the reason for using this code:
if me.dirty = true then
me.dirty = false
end if
What's the point of resetting the Dirty property on a form?

Either way, referential integrity is a good thing. If you're trying to add records to a form, and related records don't exist, you should be dealing with that situation. I'm assuming that means you need to write code to add the appropriate records to the other tables.

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
DoubleD,

To tell you the truth im not sure...I was reading a post regarding a similar problem and that was how they fixed it. However, it worked fine until i realized that eferential integrity is off, and like u said is a good thing when its on.

Now, ive been attempting to get a textbox to update when the calendar dates are pressed, but haven't done vb since 1st semester (currently in 4th) so ill admit that im a bit rusty...I tried running a onupdate procedure but cant seem to get that to fire ...

thanks,

dave
 
In the AfterUpdate event of the field on the calendar form, put the following code:

Forms!NonCalendarForm.FieldYouWantUpdated = Me.FieldCalendarUpdates

btw: the date field is on one form and the calendar is on another form that opens up. They are both connected to the same database field via control source.
The two text boxes should not be pointing to the same field on the same Table. I'm assuming you want the Calendar form so you can select a date, but you really just need to hold that piece of info so you can populate the other form you're working on. The code listed above would accomplish that for you.

I'll need more detail about what your Calendar form does before I can be sure I'm giving you valid advice.


I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
DoubleD,

Well, i think u assumed correct. The date text box has a button beside for those who cant type fast :D and want to select the date from the calendar. When the button is pressed the form opens with a calendar on it, and updates the text field beside the button.

hope that helps...


dave
 
Ok, then none of the fields on your Calendar form should be populating your tables, the form should only be used to pass a date back to your original form. If you've got the control source of your Calendar form set to any of your tables, remove it. Then use the code I posted previously to push the selected date back to your original form.

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
Me.FieldCalendarUpdates - what is this refering to? the calendar or the field the calendar updates?




:D thanks for putting up with the n00b questions :D
 
doubled,

never mind...worked like a charm!!! spelling mistake :| and you would think being able to type without look at the keyboard would make things faster...

thanks for your help!



dave
 
Glad to hear you got it working.

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top