Access 2007 button addition

5 pts.
Tags:
Access 2007
Access 2007 forms
Access 2007 functions
Access forms
Hello I have what I assume to be an easy question that hopefully someone can help me out on. I have a form that I need to add a button to that will pop up a box that you can write a description in. It needs to be different for each record that comes up in the original form. Does anyone know how to do this? Thnaks for any help you can provide!

Software/Hardware used:
Access 2007

Answer Wiki

Thanks. We'll let you know when a new response is added.

create your table. pick a field to store the caption.
create a button. for below I called it command2
under properties for that button clear the ‘picture’ field.
create some code, under ‘on click’ for that button add the following.
below prompts for string when they ‘click’ on the button

Private Sub Command2_Click()
Dim temp
temp = InputBox(“Give me a title”) ‘ prompt for a string
Command2.Caption = temp ‘ update the caption for this button
Me.Field2 = temp ‘ field defined to your table
RunCommand acCmdSaveRecord ‘ save the record
Me.Refresh ;refresh the screen
End Sub

under form property add some vba to ‘on current’
below updates the ‘button’ as they scroll through the records
btw: I do not have field2 defined to the form but it is in the table this form is referencing

Private Sub Form_Current()
Dim temp
If IsNull(Me.Field2) Then ‘ if new record or field2 is null then prompt
temp = InputBox(“Give me a title”) ‘ ok, give me title for this button
Command2.Caption = temp ‘ update the caption for this button
Me.Field2 = temp ‘ update field2
RunCommand acCmdSaveRecord ‘ save the record
Else
Command2.Caption = Me.Field2 ‘ ok, already have data, display it. no prompt
End If

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Chippy088
    You could try adding a remarks item from the table design function, and create a button linked to it on your form.
    4,625 pointsBadges:
    report
  • orangehat
    I forgot the End Sub at the end of the Private Sub Form_Current() End Sub
    1,525 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following