check box on form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a command button that runs through all my text boxs and copys the last
record entered. I program the button to use the ctrl ' to copy the last item.
but when it goes over the check box it woun't do anything. If i go to the
table and try the ctrl ' it works just fine. The other boxes of the form work
fine too. thanks for any help.
 
Not sure without seeing your code, but since there's nothing mysterious about
the checkbox control, I would guess that your code does not actually access
it. How about inserting a debugging MsgBox into your loop? Something like:

Dim ctl As Control
MsgBox(ctl.Name & " = " & ctl.Value)

Failing that, please post your code.

HTH
Sprinks
 
the code i have applied to the command button is this
i have the focus set to the first text box and then it tabs to the next box
and fills in the last record entered for each box. But when it come to the
check box, wheather the check box was chceked before or not it does
nothing.If i go to the table and try manully pressing crtl ' it works just
fine. Hope this helps to clearify things.
Me![TRUSS NUMBER].SetFocus
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
 
This is the code that i have on the command button to run through each text
box and press ctrl ' to copy last information i entered on the previous
record. when it goes through the text boxes it works fine but when it gets to
the check boxes it does not work. i went to teh raw table and tried pressing
ctrl ' and it works for the text boxes and the check boxes. i have no clue.
Thanks Erik


Me![TRUSS NUMBER].SetFocus
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
SendKeys "{TAB}", True
SendKeys "^(')", True
 
Erik,

I'm not sure why the code isn't working. I don't use SendKeys.

But you're in luck, because there's a much easier and foolproof method for
making a duplicate record (with a different autonumber key, of course). If
you use the wizard and select Record Operations, Duplicate Record, Access
will create the code for you:

Private Sub Command7_Click()
On Error GoTo Err_Command7_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

Exit_Command7_Click:
Exit Sub

Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click

End Sub

This code operates slightly different than yours in that it runs from an
existing record, and duplicates it rather than beginning from an empty new
record. If you'd rather it do the latter, just add code to return to the
previous record before executing:

DoCmd.GoToRecord , , acPrevious

HTH
Sprinks
 
Back
Top