Hi,
I am creating reports automagically by selecting an existing query and clicking Create Report. Very cool and the layouts are easy to modify.
In fact, the same Layout extends from the Header section across the detail section, which makes it easy to resize columns without manually re-aligning...
Hi, I think I can see what you're trying to do. You need the format rs("NameOfField") to do this:
rs.AddNew
For Each c In Me.Controls
If c.ControlType = acTextBox Then
If Not (c.Name = "txtID") Then
rs(mid(c.name,4)) = c.Value...
Some logic:
Last Monday logic.
What is the first day of the new Year? Easy, 01/01/(parYear+1)
Say that first day is a Monday, what day do we want to find? The Monday before ie -7 days.
Is there an easy way to do it? Yes, Monday is Day 7 whenever we start counting from Tuesday. That is...
Hi, here's a start. Sorry, bit busy at the moment! You'll have to check it.
Function LastMonday(parYear as long) as date
LastMonday = DateAdd("d", -Weekday(dateserial(paryear+1,1,1), vbtuesday), dateserial(paryear+1,1,1))
End Function
So you need a function like
mydate = getFirst("Monday", 2017)
which returns the date of the first Monday in the Year?
And similarly for the last, say, Friday?
When you create the SQL string, all the values you are inserting into it get converted to strings, so it doesn't matter what data types you've used in your dim statements.
What is important is that the resultant SQL string is valid. And that depends on the data types in the table, not the data...
When I look at your SQL string, it has quotes around every fieldname except the date. So would it be correct to say that those other fields are all text? If any field is actually a number, remove the quotes around it.
If no luck there, try my second suggestion. It seems like a lot of trouble...
Hey Sting,
This is what I would try next - 2 things:
Put square brackets around all those deeply terrible Field names that you have inherited.
If that doesn't work, before your bad line (that is, the DoCmd.RunSQL), enter Debug.Print strSQL
Run the code again, open the Immediate Window (ctrl-G...
Primarily, if the IDs are not 'ad hoc', but in a queryable structure, you could also use an 'In' subselect. Which allows you to select tbo or mbre values ahem.
Also, ShipID 26 and ShipID 27 are some sort of avoided craft in this query, maybe they're submarines or something? So I would be...
Sydney airport is the worst thing about Australia. And the electricity prices, they're the worst thing too. Let's know when you come again. I went to an Access dev conference at Reading when I was over there in 2010, had lotsa fun.
Jack
Actually, comes with 2 warnings: When a Mr O'Riordan or Mrs O'Reilly comes along, it will confuse the SQL, so you'll need to escape the quotes.
Try: Replace(lastname, "'","''") instead of using lastname on its own.
Jack
Hey Stingo, you are nearly there:
Dim strSQL as string
strSQL = "INSERT INTO tUsers(fname, lname, email) VALUES ('" & FirstName & "', '" & LastName & "', '" & UserEmail & "');"
DoCmd.RunSQL strSQL
Be careful with the quotes around the names.
However, this suggestion comes with a warning...
Hi all, I'm a long-time Access dev, mainly working in Banking and Finance for the last couple of decades. I've led a few access dev teams, and been involved with creation and management of SDLCs, a complex task given the built-in controls and restrictions that banks want - eg software libraries...