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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting values on forms with VBA

Status
Not open for further replies.

cranebill

IS-IT--Management
Jan 4, 2002
1,113
US
Ok here is the code...

Private Sub Command66_Click()
Dim First As String
Dim FirstMemo As String
Dim Second As String
Dim SecondMemo As String

First = Forms!FollowUpsDueToday!FirstFollowUpSent
FirstMemo = Forms!FollowUpsDueToday!Notes
Second = Forms!FollowUpsDueToday!SecondFollowUpSent
SecondMemo = Forms!FollowUpsDueToday!Text54

DoCmd.OpenReport "FollowUpFax", acViewNormal, , , acWindowNormal
Select Case First
Case 0
First = 1
FirstMemo = FirstMemo & " Faxed on " & Date
Case 1
Second = 1
SecondMemo = SecondMemo & " Faxed on " & Date


End Select


End Sub

First and Second are both check boxes so the value should be 0.

I want this so that when i click the box it automatically fills in that i haved faxed this document. Apparently my minor stab at this wasnt all that easy although it does fax, but does not set the values in the form. All the items on the form are bound to a query, could that be the problem?

Bill
 
Hi,

Values for the checkbox are 0 for false/off and -1 for true/on.

You should be checking for and setting to 0/-1, or true/false.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Try this:
Dim First As Control
Dim FirstMemo As Control
Dim Second As Control
Dim SecondMemo As Control

set First = Forms!FollowUpsDueToday!FirstFollowUpSent
set FirstMemo = Forms!FollowUpsDueToday!Notes
set Second = Forms!FollowUpsDueToday!SecondFollowUpSent
set SecondMemo = Forms!FollowUpsDueToday!Text54

you are assigning to local variables instead of to form objects, so the form isn't being updated.
 
Hi beetee,

After setting the table values to 0 or 1, how will another form's checkbox control react to receiving +1?

It expects 0 or -1 for False or True.

You gave the solution to the question, but was there any point?

Regards,

Darrylle

"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Interesting you should ask that. I tried using 1 and 0 and it seemed to work just as well as using -1 and 0.

However, it was my feeling that if you added our two posts together you would reach something approximating the truth.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top