Insert Into

pdvsa
pdvsa used Ask the Experts™
on
Experts:
In the below, how can I set the value of the combo box on tblLCAmendHistory to ID=14 which corresponds to the word "ISSUE"?
I have a row source qry on AmendType in tblAmendHistory:
SELECT tblLCAmendTypeDropBox.ID, tblLCAmendTypeDropBox.Type FROM tblLCAmendTypeDropBox ORDER BY tblLCAmendTypeDropBox.Type;

I have not tested the below yet so there could be something wrong with the AmendType part.  I dont know if I need it in the first part or if I could remove it completely.

Also, if the LCNo is "" then I would want the code to stop and I think Cancel = True stops the code and therefor no insert.  Let me know that is correct.  

basically what I am doing is after user inputs a date in the field [DateOfIssueSB] then it should INISERT. I am not sure if I should use BeforeUpdate or AFterUpdate.  I think it might be beforeUpdate because need to test if Null but not sure if the date entered by user will be "seen" in the BeforeUPdate event.  

Anyways, any questions please let me know.

Private Sub txtDateOfIssueSB_BeforeUpdate(Cancel As Integer)

       Dim strSQL As String
 
   If Me.LCNo = "" Then
        MsgBox "Enter in the LC No before Entering the Issue Date (need it for Insert Event)"
        Cancel = True
   
     ElseIf (Me.DateOfIssueSB) = "" Then
    'wanting to insert the Date that was entered but only if it was Null before the date was entered.  If not null before update then that means there was a date already entered and dont want to do any Insert.

  strSQL = "INSERT INTO tblLCAmendHistory (AmendedDate, letterOfCreditID, EndUserID, LCNo, AmendType) VALUES (#" & Format(Date, "m\/d\/yyyy") & "#," & Me!ID & "," & Me!EndUserID & ",'" & HyperlinkPart(Me!LCNo, acDisplayText) & "' "    'NOT SURE WHAT I WOULD PUT HERE IF ANYTHING TO SET THE THE VALUE TO EQUAL "ISSUE" IN THE COMBO BOX. ON TBLAMENDHISTORY.
 
  End If
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hamed NasrRetired IT Professional

Commented:
Attach a sample database, and supply steps to follow to get the results.
pdvsaProject finance

Author

Commented:
I opened the attached and I think you will get an error because I cant save the file with my changes to auto exec form to open.  If you can just open frmLetterOfCredit_cont please.  
pdvsaProject finance

Author

Commented:
it is 2k7
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Hamed NasrRetired IT Professional

Commented:
Looks like you pressed submit without Adding File.
You need to press File---Then Add File Then Submit.
Don't foreget instruction, to open file, and type what, and to expect what, but you get other output.
pdvsaProject finance

Author

Commented:
Oh i am out of it today.   I have been doing too many things at once.   I am not at computer at the moment.   I think you are outside the usa too.   Will upload soon...
pdvsaProject finance

Author

Commented:
Hnasr:  attached is the file...

New---use-this-for-EE.zip
Retired IT Professional
Commented:
Please give instructions to follow to see the problem.
Ex:
Open form: frmLCAmendedHistory
Select/click ..., you get ..., but I expect ...
pdvsaProject finance

Author

Commented:
Hnasr:  will get back to you shortly.  I have been out on vacation and will revisit at another  time.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial