Delete in table from input box

dimanche 1 mars 2015

I'm having trouble executing a SQL command in VB... I want it to find the the value of the input box in TBL-Purchases and Delete all related values. Here's my code.... I get an error on the line I've highlighted in green... Any thoughts?





Private Sub Command31_Click()

Dim Message, Title, Default, MyValue1, MyValue2

Title = "Sell Stocks"

Default = ""

MyValue1 = InputBox("Which stock ticker name would you like to sell?")

MyValue1 = UCase(MyValue1)

If MyValue1 = Empty Then Exit Sub

If MsgBox(MyValue1 & "?", vbQuestion + vbYesNo) = vbYes Then

MyValue2 = InputBox("How many shares would you like to sell?")

If MsgBox(MyValue2 & "?", vbQuestion + vbYesNo) = vbYes Then

MsgBox ("You have chosen to sell " & MyValue2 & " shares of " & MyValue1 & ".")



DoCmd.RunSQL "DELETE * FROM TBL-Purchases WHERE [Stock ID] = MyValue1"



Else: MsgBox ("You did not enter an appropriate value.")

End If

End If





End Sub

Delete in table from input box

Access Web 2010 - accessing Sharepoint Author and Modifier

We're running an Access 2010 web database.



As expected when we published to Sharepoint additional fields were added to the Access tables [App Created By] and [App Modified by]. We want to use these fields for Audit information however they are always empty. How should they be populated?

Access Web 2010 - accessing Sharepoint Author and Modifier

Button overwrite last record

Hi,



I'm trying to develop a Visitor log where I'm using a main form with the guest details and a sub form where sign in/out times and location are entered. In the header I have a combobox with already registered guests, a create guest / sign in button and a sign out button.



My problem is when I hit the create guest / sign in button the data from the location field overwrites the last record and no vba code for this action have been written as I see it?



The code:

Private Sub OpretKnap_Click()

With CodeContextObject

If (.Form.Dirty) Then

DoCmd.RunCommand acCmdSaveRecord

End If

End With




'Sub form

With Me.Logdetaljer.Form.RecordsetClone

.AddNew

!Tlfnr = Me.Tlfnr 'Phone no.

!Logind = Now() 'Time of sign in

!ArbSted = ArbSted 'Location

.Update

End With


DoCmd.GoToRecord , "", acNewRec

DoCmd.GoToControl "Navn" 'Go to guest name


End Sub





Hope someone are able to tell me what to do...



Many thanks in advance!!

Button overwrite last record

Newbie

Hello everyone,



New to this forum .... although I've seen some useful responses to queries that I've already used :) Also new to Access .... had it for a few weeks and have already been able to create some useful tables, queries and a couple of reports that have amazed people at work. I'm considered a bit of an Excel 'guru' at work and years ago got City & Guilds certified in Advanced Visual Basic Programming. Looking forward to gaining knowledge in Access through some training courses and this forum! Just goes to show that you can teach an old dog new tricks :)

Newbie

Bigger... plusses?

Sorry, very simple one from a total novice, I've tried to Google, but I don't know the name by which to refer these little plusses you get...



I'm making a form, the form has a table, the rows of the table have a plus next to them, indicating that the linked table's information can be seen if you click it...



All I want to know is, can I make these little plusses bigger? They're a bit small for my liking.



Thank-you and sorry.

Bigger... plusses?

Newcomer post

Hello there! I've been working with Access for the last 5 months. Hope the forum will help sharing skills and knowledge!

Newcomer post

Query to select all data regarding a clicked field

Is this even possible? Let me talk you through this scenario. I have three tables. TableA contains certain order information, such as the username of the employee, type of order, alias number, etc. TableB contains phone numbers, username of the employee, etc. TableC contains supervisor names and alias numbers.



I didn't make these tables but that's what I'm working with. I connected TableA to TableB with the username of the employee, and then TableA to TableC using the alias numbers.



I have a report that summarizes how many orders of each type there are. It shows the supervisor, employee username, alias numbers and then each type of order with the amount of orders of each type under the headers.



My boss wants to be able to click on the amount of that type of order and have it show him the details for those orders. This is where my problem is.



I was able to use an Inner Join type of query that allows me to filter the data by order type (however, I have to make a new query for each order type since I'm not too experienced on this). The problem is that I cannot find a way to have a query filter the data by order type AND employee username, so that it only displays the orders taken by a certain employee and it only contains one order type at a time, depending on which order type you clicked.



Again, is this even possible?

Query to select all data regarding a clicked field

Labels