textbox button

le888

Registered User.
Local time
Yesterday, 22:31
Joined
Dec 10, 2003
Messages
344
Hi everyone,

I have a problem with my textbox button which is use like a command button. This txtbox command button delete a record and it is on a continous form. My problem is when the focus is on the first record but the user delete say the third record and click on the button, it delete the first record. So, how can I fix this problem. If I use the "real" button fuction ( which is created by the wizard) I don't have this problem. The texte box button has the same code as the command button which I created with the wizard.

Can someone explain why?

Thanks,

Le
 
What's the code for the command button and the text control?

Why are you doing it this way? Why not use a command button on your continuous form? So that you have a delete button on each record line. It's much clearer to the user which record will be deleted.
 
Code:
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click

    
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_cmdDelete_Click:
    Exit Sub

Err_cmdDelete_Click:
    MsgBox Err.Description
    Resume Exit_cmdDelete_Click
    
End Sub

Well, because I have more option with text control. I mean with the text control I can make it appeare like a internet link which I can't with the command button. The text control are also on each record line.

Thanks for your response,

Le
 
Which event are you using in the text box to run the code?
 
And what's the code behind the click event of the textbox?
 
dcx693 said:
And what's the code behind the click event of the textbox?

The same as I posted previously.
 
Based on your description, I can't see what's going wrong. Can you post a sample copy of the db on the forum and I'll take a look?
 
dcx693 said:
Based on your description, I can't see what's going wrong. Can you post a sample copy of the db on the forum and I'll take a look?

Thanks for the help. Here is the sample.

Le
 

Attachments

I still don't know what the difference is, but I typically hate using any DoMenuItem or Sendkeys stuff since it seems highly dependent on things being "exactly" right.

And since there are DoCmd.RunCommand equivalents for all the DoMenuItem commands, I simply replaced your code with:
DoCmd.RunCommand acCmdDeleteRecord

and it seemed to work for both the label and the command button.

FYI: You can use the MouseMove events of the controls and the form to further simulate web links by changing the color of the link when the mouse is hovering over the label control.
 
I know little about contiunous forms, other than the fact that seem to cause beaucoup problems, compared with standard forms, but I am confused by something in the original posting for this thread:

"My problem is when the focus is on the first record but the user delete say the third record and click on the button, it delete the first record..."

Can someone explain to me how the First Record can have the focus if the Third Record is being worked with (deleted) ? Just curious.

Thanks.

The Missinglinq :confused:
 
Rich said:
Why are you using a textbox and not a button?

Sorry that I didn't answer this question because I didn't receive this reply.
Because I don't like the command button, I have no option to make like a hyper link.

Thanks,

Le

P.S. Thanks Rich, if you didn't point to this email. I would think to return to see. Because I thought that each person who reply your e-mail, it will popup on the outlook. In this case, it didn't.
 
Thanks for taking care of my problem. I think you didn't see the problem. In my example try this :
1) Tape a client name, let's say "Client # 34 "
2) Tape a requirement name, let's say " Req # 34 First"
3) Tape a requirement name, let's say " Req # 34 Second"
4) Delete "Req # 34 Second " but put the focus on "Req # 34 First"

You will see the record "Req # 34 First" is deleted.

Le
 

Users who are viewing this thread

Back
Top Bottom