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!

Command button help

Status
Not open for further replies.

rlmorgan

Technical User
Jun 2, 2006
32
US
I need some help on this one.
I have a form that has information on an item in inventory. In that form, a subform has a list of parts ordered for that item that inclueds dates ordered, received and returned.

I would like to have a command button that will add the date to the active parts record in the subform by using the following code:

Private Sub cboReceived_Click()
Me![DateReceived] = Now()
End Sub


I have tried every way I can think of to get it to work. Any Help?
 
How are ya rlmorgan . . .

Apparently the button is on the mainform, so try:
Code:
[blue]   Forms![purple][b]MainFormName[/b][/purple]![purple][b]subFormName[/b][/purple].Form!![DateReceived] = Now()[/blue]

Calvin.gif
See Ya! . . . . . .
 
BTW, cboReceived refers to a combo box. Proper naming convention for a command button would be cmdReceived

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
. . . and there's one too many exclamations in the code line:
Code:
[blue]   Forms!MainFormName!subFormName.Form![DateReceived] = Now()[/blue]

Calvin.gif
See Ya! . . . . . .
 
I wondered about that, AceMan1, but you are.....the AceMan1, you know?

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
Thanks for the answer. Sorry about using cbo over cmd. Too much cutting and pasting as I was pulling my hair out. I was close on my attempts, I had tried the following:

Forms!frmParts!frmPartsSub.[DateReceived] = Now()

Your code worked perfectly

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top