var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Programming conventions and SQL sequence
Hi, it's my first post on this forum =) So, hi to all and hope in new future I could contribute to the community as well.
Regards to my questions, I have done some programming in a few languages, but not in SQL or VBA and I quite confused about programming styles that VBA and SQL accepts.
I'm currently working in Microsoft access and the thing I'm stuck on is copying values/field from a record into another record on the same table.
For example the table looks like the following:
ID Name Year Month Date
1 Steven 1979 9 18
2 Jeremy 1977 10 22
3 Eslynn 1988 10 10
I've built a form that contains two lables, "ReplaceMe" "LoadMe" and a command button. Which end user could choose which record to load and which to replace.
I wish to copy Year, Month and Date from LoadMe into ReplaceMe without effecting the Replace me ID and Name.
The VBA, SQL code i've got looks like.
Private Sub Command_Click()
Dim UpdateSQL As String
'users-Table is a table, containing several objects and fields.
UpdateSQL = "INSERT INTO [users-Table]( [Day], [year], [month] ) " & _
"SELECT users.Day, users.year, users.month" & _
"FROM users.[LoadMe]" & _
Well the obvious, the above code doesn't run. What I wanted to find out is, when do I use [ ] ( ) ! .
Like... if I wanted to read the field value of "Date" from the object from the "Name" in combo box "LoadMe", what should I write?
ie, if the combo box "LoadMe" contains Eslynn. The end result should be 22.
Just a hint, instead of single quotes use double quotes around "ReplaceMe", See if that works. Also you only need to use brackets  around columns that have spaces in the name.
Sometimes access is a little funny about the sql syntax so a lot of times I will make the query using the query builder and then view sql (SQL View), that option should be in the upper left corner under the design option. If you can't find the SQL view option look in the help section.
I sure this helps.