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

Button to display current record in a MsgBox 1

Status
Not open for further replies.

joopa

Technical User
Sep 9, 2002
26
US
I wan't to make a button that displays the current record on the form in a Msgbox. I am not sure how to bind to current record in Code. I tried to use the Macro but that didn't work.

I know this is basic.

Thanks
 
How are ya joopa . . . .

This is easily done, except you have not specified just what fields you desire to see!

Anyway in the [blue]Click Event[/blue] of a command button, do something like this:
Code:
[blue] Dim Msg As String, Style As Integer, Title As String

Msg = "YourMessage" & Me!YourField & " MoreText"
Style = vbInformation + vbOKOnly
Title = "Text for the Title Bar"
Call MsgBox Msg, Style, Title[/blue]

cal.gif
See Ya! . . . . . .
 
Thanks Aceman,

That was easy.
Next I want to have this button in a Subform and clicking it make the selected record (say Customer_ID field value) pasted into a current record field in my Main Form.

I can't use Me! for the current record in my Main form, sine the button is in the Subform. Can I use the CurrentRecord function? The tables are not related.

Thanks a lot.
 
joopa . . . . .

With a button on the subform:
Code:
[blue]   Dim frm As Form
   Set frm = Forms![purple]YourMainFormName[/purple]
   frm!Customer_ID = Me!Customer_ID[/blue]


cal.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top