First Timer, Required Fields - Almost There

undefeatedskillz26

Registered User.
Local time
Today, 17:41
Joined
Nov 26, 2014
Messages
51
Okay I think I am almost there. I have a simple form to enter first name and last name. When I click the cmd button it opens the Query up. I don;t want to open the query up just for the First name and Last Name to go to the Table. The Tables are located on another server but I have it linked, if that helps. I have a query running and it goes to the table, but I dont want the query to open up every time I hit the cmd button. Please help. Hopefully I am going the right way.
 
Last edited:
Add an Exit Sub to the ElseIf and you should be good to go. And as I mentioned on your other thread, you don't need the CancelEvent lines.
 
Add an Exit Sub to the ElseIf and you should be good to go. And as I mentioned on your other thread, you don't need the CancelEvent lines.


Hi pbaldy

Thank you for replying. I am so close. Thank you, thank you!!!

I removed the Cancel event.

Now when I put the code in below the information will submit to the table but will not close the form. When I click the cmd button it just sits there.

It will say First Name or Last Name required, but after I fill out information it will not close the form. I have tried using google and this thread for ideas and got this far, but still can't complete the deal. I think if I am able to close the form than I should be good to go. Hoping....
 
Last edited:
The second Exit Sub needs to be within the ElseIf, just as the first is within the If. Where you have it now, the code will never get to the open query line.
 
The second Exit Sub needs to be within the ElseIf, just as the first is within the If. Where you have it now, the code will never get to the open query line.


Thank you pbaldy again. I wish i could give you a hug for being so kind.

Now when I hit the cmd button it opens "qrySuggestions"

I know what code opens it up, but how else do i get the information to the table. Would like it to not open the qry everytime I hit the cmd button, wouldnt that be the right way.
 
Last edited:
Is qrySuggestions an append query that is appending the data to the table? If so, I wouldn't expect it to stay open. If the form is bound to the table (the form's record source property), closing it will save the data. That is the "normal" way to get data from a form to a table.
 
Is qrySuggestions an append query that is appending the data to the table? If so, I wouldn't expect it to stay open. If the form is bound to the table (the form's record source property), closing it will save the data. That is the "normal" way to get data from a form to a table.

The query is not an append query. It is a normal Query. I am not sure do I need the Qry? If I delete it I think it still works, I tried it before and it was working fine. When I click the cmd button doesn't or can the information just go to the table and the qry not be needed?

I guess I am trying to figure out how to get the information from th form to the table. If I qry is needed how do I get it so that the qry won't open each time? If it's not needed can i delete the qry line in the VBA code, but than how will it get to the table?

Learning as much as I can as i go along. As each week goes by I learn more and more.
 
Last edited:
UPDATE:

I removed the line and its working. So since I have the record soruce bound to the table that is how the form get's the data to the table.

If I was using an append qry than I would have to open the qry to get the info to the table, right? I think I am understanding a little more.

So now I can delete the qry since it is not an append qry. Right? :)

Thanks sooooooooooooooooooooooooo much!!!!!!!!!!!!!!!!!! You rock!!!!!!!! I have bookmarked your site. Wish we could be buddies on skype or aim or something. I am going to put the back end of my database on SQL Server.

I was in Vegas 1 month ago wished I could of visted you and said thank you personally. have a great night!!!

I have another question I may need coding but want to do some more research. Thanks and thanks again my friend!!!!!!! So happy!!!!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom