Newbie - I have tryed this

eholtman

Registered User.
Local time
Yesterday, 23:34
Joined
Oct 12, 2004
Messages
54
Ok starting off I have been reading on VB and I am new. I am having a tough time understanding a basic function.

I am in my Forms of Access and what I have is a Requester combo box with my seclections. When the requester name has been pulled down it will pop up a box Asking if it is the same as the Engineer.

Code.

Private Sub Requester_Click()

intPress = MsgBox("Is the Submitter the same as the Engineer?", vbQuestion + vbYesNo, "Engineer")
End Sub


This works fine.

But where I am running into a wall is that I need to build "If Yes copy data to "Engineer"" (Engineer is a Field in one of my Tables) If no Say "please select Engineer".

Thanks
 
Use something like this:

If MsgBox("Is the Submitter the same as the Engineer?", vbQuestion + vbYesNo, "Engineer") = vbyes then

nameofcombobox = engineer

else

docmd.openform "formname"

endif

NOTES:

I would personally have the engineer textbox visible on the same form so that way you could just set focus to that control in the else statement with an additional msgbox telling them to input the engineers name. If you didn't want it visible I would just make it hidden (assuming engineer resides in the same table as requestor) and do the popup form and have it set the value to the hidden control on close of the popup.

Or if engineer resides in another table, just do the openform clause. I would create a simple form that acts as a popup.

Hope this helps.
 
Thanks MC
I would personally have the engineer textbox visible on the same form I agree I have both text boxes on the same form

Requester - Pull Down

Engineer - Pull Down

If I am checking Yes it doesnt seem to be updating the Engineer field.

The Engineer and Requester field are seperate fields in my table. So if Requester is Yes than copy name to Engineer. If no state "Please select Engineer"
 
Use this code then:

After Update property for ComboRequestor

If MsgBox("Is the Submitter the same as the Engineer?", vbQuestion + vbYesNo, "Engineer") = vbyes Then

[ComboRequestor] = [ComboEngineer]

Else

forms!formname![ComboEngineer].setfocus

End If

If you need anymore info, give me your actual form and control names and I will write the exact code.
 
Thank You

MC.

Yes that worked Thank you for taken the time and assisting. I have been thrown into creating Access databases with in one week I knew nothing about Access and VB and have been able to create a nice order form. But sometimes no matter how many times you read it. It does not click. I will countinue to ask questions for the next couple of weeks. But hopefully as the months come I can start answer some questions.
 

Users who are viewing this thread

Back
Top Bottom